Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

This library allows you to build url string query for typeorm-server-query-builder.

License

Notifications You must be signed in to change notification settings

justkey007/typeorm-front-query-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easily build requests on url for your server which uses typeorm-server-query-builder.





TypeORM Frontend Query Builder

This library allows you to build url string query for typeorm-server-query-builder.

Installation

npm install typeorm-front-query-builder

Usage

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

Available Lookups

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

Options

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

Others methods

Get a raw request object to pass it to an http POST request body for example

public getRawObject(): object

Get the query string to form a query on url (?)

public toString(): string

About

This library allows you to build url string query for typeorm-server-query-builder.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published