UNPKG

@lcap/nasl

Version:

NetEase Application Specific Language

50 lines (44 loc) 3.36 kB
declare namespace nasl.langUtil { export class Collection<Arr extends Array<any>> { // name = 'Collection'; FROM<T extends Array<any>>(collection: Collection<T>): Collection<T>; INNER_JOIN<K extends Array<any>>(collection: Collection<K>): Collection<[...Arr, ...K]>; LEFT_JOIN<K extends Array<any>>(collection: Collection<K>): Collection<[...Arr, ...K]>; RIGHT_JOIN<K extends Array<any>>(collection: Collection<K>): Collection<[...Arr, ...K]>; OUTER_JOIN<K extends Array<any>>(collection: Collection<K>): Collection<[...Arr, ...K]>; ON(expr: (...types: Arr) => nasl.core.Boolean): Collection<Arr>; WHERE(...exprs: Array<(...types: Arr) => nasl.core.Boolean>): Collection<Arr>; WHEREPLAYGROUND(...exprs: Array<(...types: Arr) => nasl.core.Any>): Collection<Arr>; GROUP_BY(...exprs: Array<(...types: Arr) => any>): Collection<Arr>; SELECT(...exprs: Array<(...types: Arr) => any>): Collection<Arr>; HAVING(...exprs: Array<(...types: Arr) => nasl.core.Boolean>): Collection<Arr>; HAVINGPLAYGROUND(...exprs: Array<(...types: Arr) => nasl.core.Any>): Collection<Arr>; ORDER_BY(...exprs: Array<(...types: Arr) => any>): Collection<Arr>; LIMIT(expr: (...types: Arr) => any): Collection<Arr>; // PAGINATE(page: nasl.core.Long, size: nasl.core.Long): Collection<Arr> // SELECT_PAGE_OF<R>(expr: (...types: Arr) => R): <R> } export function FROM<T extends Array<any>>(collection: Collection<T>): Collection<T>; export function STARTWITH(str1: nasl.core.String, str2: nasl.core.String): nasl.core.Boolean; export function ENDWITH(str1: nasl.core.String, str2: nasl.core.String): nasl.core.Boolean; export function LIKE(str1: nasl.core.String, str2: nasl.core.String): nasl.core.Boolean; export function IN<T>(value: T, list: nasl.collection.List<T>): nasl.core.Boolean; export function ISNULL(value: any): nasl.core.Boolean; export function NOT(value: nasl.core.Boolean): nasl.core.Boolean; export function COUNT(value: any): nasl.core.Long; export function COUNTD(value: any): nasl.core.Long; export function SUM<T extends nasl.core.Long | nasl.core.Decimal>(value: T): T; export function AVG<T extends nasl.core.Long | nasl.core.Decimal>(value: T): nasl.core.Decimal; export function MAX<T extends nasl.core.Long | nasl.core.Decimal | nasl.core.Boolean | nasl.core.String | nasl.core.Date | nasl.core.Time | nasl.core.DateTime>(value: T): T; export function MIN<T extends nasl.core.Long | nasl.core.Decimal | nasl.core.Boolean | nasl.core.String | nasl.core.Date | nasl.core.Time | nasl.core.DateTime>(value: T): T; export function ruleIn<T>(value: T, list: T): nasl.core.Boolean; // export function CONCAT(a: nasl.core.String, b: nasl.core.String): boolean } // namespace app.dataSources.defaultDS.entities { // } // nasl.langUtil.FROM(new nasl.langUtil.Collection<[app.dataSources.defaultDS.entities.Student]>() // .LEFT_JOIN(new nasl.langUtil.Collection<[app.dataSources.defaultDS.entities.School]>()) // .ON((Student, School) => Student.schoolId === School.id)) // .WHERE((Student, School) => Student.age > new nasl.core.Long(200)) // .ORDER_BY((Student, School) => Student.name, 'ASC') // .SELECT((Student, School) => ({ Student, School }))