2.0.1 • Published 4 months ago

linquest v2.0.1

Weekly downloads
10
License
MIT
Repository
github
Last release
4 months ago

linquest - Remote Linq implementation with Jinqu infrastructure

Build and Test codecov Codacy Badge

npm version npm downloads

GitHub issues GitHub license GitHub stars GitHub forks

Written completely in TypeScript.

Installation

npm i linquest

Let's See

// first, create a service
const service = new LinqService('https://my.company.service.com/');
// then create a query
const query = service.createQuery<Company>('Companies');
// execute the query
const result = await query.where(p => p.Id > 5).toArrayAsync();

Request providers

Linquest uses fetch as default, you might need to use a polyfill.

To use a custom request provider, you need to implement IAjaxProvider interface from jinqu

import { IAjaxProvider, AjaxOptions } from "jinqu";

// implement the IAjaxProvider interface
export class MyAjaxProvider implements IAjaxProvider {

  ajax<T>(o: AjaxOptions): Promise<T> {
    // implement this
  }
}

// inject provider to LinqService
const service = new LinqService('https://my.company.service.com/', new MyAjaxProvider());

Code Generation

With code generation from a metadata (like Swagger or OpenAPI, you can really simplify the usage.

// generated code
export interface Company {
    id: number;
    name: string;
    createDate: Date;
}

export class CompanyService extends LinqService {

    constructor(provider?: IAjaxProvider) {
        super('https://my.company.service.com/', provider);
    }

    companies() {
        return this.createQuery<Company>('Companies');
    }
}

// and you can use it like this
const service = new CompanyService();
const query = service.companies().where(c => c.name !== "Netflix");
const result = await query.toArrayAsync();

Old Browsers

linquest uses jinqu as a querying platform, if you want to use jinqu features with old browsers, please refer to jinqu documentation.

License

Linquest is under the MIT License.

2.0.1

4 months ago

2.0.0

4 months ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.4.0

7 years ago

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago