Easily build requests on url for your server which uses typeorm-server-query-builder.
This library allows you to build url string query for typeorm-server-query-builder.
npm install typeorm-front-query-builder
import { Query } from 'typeorm-front-query-builder';
const query = new Query();
query.fieldBetween('age', 18, 45).join(['posts', 'photos']);
const urlQuery = query.toString();
// age__between=18,45&relations=posts,photos
Lookup | Method |
---|---|
(none) | fieldEqual(field: string, value: Primitive, not = false): Query |
contains | fieldContains(field: string, value: Primitive, not = false): Query |
startswith | fieldStartsWith(field: string, value: Primitive, not = false): Query |
endswith | fieldEndsWith(field: string, value: Primitive, not = false): Query |
isnull | fieldIsNull(field: string, not = false): Query |
lt | fieldLessThan(field: string, value: Primitive, not = false): Query |
lte | fieldLessThanOrEqual(field: string, value: Primitive, not = false): Query |
gt | fieldGreaterThan(field: string, value: Primitive, not = false): Query |
gte | fieldGreaterThanOrEqual(field: string, value: Primitive, not = false): Query |
in | fieldIn(field: string, elements: Array<Primitive>, not = false): Query |
between | `fieldBetween(field: string, firstValue: string |
Option | Default |
---|---|
pagination | `[enable |
page | setPage(page: number): Query |
limit | setLimit(limit: number): Query |
order | `orderBy(field: string, by: 'ASC' |
join | join(relations: string[]): Query |
select | select(fields: string[]): Query |
public getRawObject(): object
public toString(): string