UNPKG

@warlock.js/cascade

Version:

ORM for managing databases

361 lines 8.22 kB
import type { GenericObject } from "@mongez/reinforcements"; /** * Get count expression */ export declare function count(column?: string): any; /** * Parse the given column */ export declare const columnName: (column: string) => string; /** * Get sum expression */ export declare function sum(column: string, baseColumn?: string): any; /** * Get average expression */ export declare const average: typeof avg; export declare function avg(column: string): { $avg: string; }; /** * Get min expression */ export declare function min(column: string): { $min: string; }; /** * Get max expression */ export declare function max(column: string): { $max: string; }; /** * Get first expression */ export declare function first(column: string): { $first: string; }; /** * Get last expression */ export declare function last(column: string): { $last: string; }; /** * Get push expression */ export declare function push(data: any): { $push: any; }; /** * Get addToSet expression */ export declare function addToSet(column: string): { $addToSet: string; }; /** * Get year expression */ export declare function year(column: string): { $year: string; }; /** * Get first value of year expression */ export declare function firstYear(column: string): { $first: { $year: string; }; }; /** * Get last value of year expression */ export declare function lastYear(column: string): { $last: { $year: string; }; }; /** * Get month expression */ export declare function month(column: string): { $month: string; }; /** * Get week expression */ export declare function week(column: string): { $isoWeek: string; }; /** * Get first value of month expression */ export declare function firstMonth(column: string): { $first: { $month: string; }; }; /** * Get last value of month expression */ export declare function lastMonth(column: string): { $last: { $month: string; }; }; /** * Get day of month expression */ export declare function dayOfMonth(column: string): { $dayOfMonth: string; }; /** * Get first day of month expression */ export declare function firstDayOfMonth(column: string): { $first: { $dayOfMonth: string; }; }; /** * Get last day of month expression */ export declare function lastDayOfMonth(column: string): { $last: { $dayOfMonth: string; }; }; /** * Get day of week expression */ export declare function dayOfWeek(column: string): { $dayOfWeek: string; }; /** * Return list of columns */ export declare function columns(...columns: string[]): GenericObject; /** Match helpers */ /** * Get greater than expression */ export declare const greaterThan: typeof gt; export declare function gt(value: any, column?: string): any; /** * Get greater than or equal expression */ export declare const greaterThanOrEqual: typeof gt; export declare function gte(value: any, column?: string): any; /** * Get less than expression */ export declare const lessThan: typeof lt; export declare function lt(value: any, column?: string): any; /** * Get less than or equal expression */ export declare const lessThanOrEqual: typeof lt; export declare function lte(value: any, column?: string): any; /** * Get equal expression */ export declare const equal: typeof eq; export declare function eq(...values: any): { $eq: any; }; /** * Get not equal expression */ export declare const notEqual: typeof ne; export declare function ne(value: any): { $ne: any; }; /** * Get in array expression */ export declare function inArray(value: any): { $in: any; }; /** * Get not in array expression */ export declare const notIn: typeof nin; export declare const notInArray: typeof nin; export declare function nin(value: any): { $nin: any; }; /** * Get exists expression */ export declare function exists(value: any, column?: string): any; /** * Get not exists expression */ export declare function notExists(value: any, column?: string): any; /** * Get like expression */ export declare function like(value: any, column?: string): any; /** * Get not like expression */ export declare function notLike(value: any, column?: string): any; /** * Get not null expression */ export declare function notNull(column?: string): any; /** * Get null expression */ export declare function isNull(column?: string): any; /** * Get between expression */ export declare function between(minValue: any, maxValue: any, column?: string): any; /** * Get not between expression */ export declare function notBetween(minValue: any, maxValue: any, column?: string): any; /** * Get concat expression */ export declare function concat(...columns: string[]): { $concat: string[]; }; export declare const merge: typeof concat; /** * Concat columns with separator between each column */ export declare function concatWith(separator: string, ...columns: string[]): { $concat: any[]; }; export declare const mergeWith: typeof concatWith; /** * Get cond expression */ export declare function cond(condition: any, ifTrue: any, ifFalse: any, column?: string): any; export declare const condition: typeof cond; /** * Boolean condition */ export declare function booleanCond(condition: any, column?: string): any; /** * Get regex expression */ export declare function regex(value: RegExp, column?: string): any; /** * You can use it when you want a field to match all the given values */ export declare function all(values: any[], column?: string): any; /** * Multiple expressions */ export declare function _multiply(...expressions: any[]): { $multiply: any[]; }; /** * Multiple columns */ export declare function multiply(...columns: string[]): { $multiply: string[]; }; /** * Divide expressions */ export declare function _divide(...expressions: any[]): { $divide: any[]; }; /** * Divide columns */ export declare function divide(...columns: string[]): { $divide: string[]; }; /** * Get size expression */ export declare function size(column: string): { $size: string; }; /** * Get round expression */ export declare function round(column: string, decimalPlaces: number): { $round: (string | number)[]; }; export declare function _round(value: any, decimalPlaces: number): { $round: any[]; }; /** * Get expression */ export declare function expr(expression: any): { $expr: any; }; export declare const $agg: { count: typeof count; sum: typeof sum; round: typeof round; _round: typeof _round; avg: typeof avg; multiply: typeof multiply; divide: typeof divide; _divide: typeof _divide; _multiply: typeof _multiply; average: typeof avg; min: typeof min; max: typeof max; first: typeof first; last: typeof last; push: typeof push; addToSet: typeof addToSet; all: typeof all; year: typeof year; firstYear: typeof firstYear; lastYear: typeof lastYear; month: typeof month; firstMonth: typeof firstMonth; lastMonth: typeof lastMonth; firstDayOfMonth: typeof firstDayOfMonth; lastDayOfMonth: typeof lastDayOfMonth; dayOfMonth: typeof dayOfMonth; dayOfWeek: typeof dayOfWeek; columns: typeof columns; gt: typeof gt; greaterThan: typeof gt; gte: typeof gte; greaterThanOrEqual: typeof gt; lt: typeof lt; lessThan: typeof lt; lte: typeof lte; lessThanOrEqual: typeof lt; eq: typeof eq; equal: typeof eq; ne: typeof ne; notEqual: typeof ne; inArray: typeof inArray; in: typeof inArray; nin: typeof nin; notIn: typeof nin; notInArray: typeof nin; exists: typeof exists; notExists: typeof notExists; like: typeof like; notLike: typeof notLike; notNull: typeof notNull; isNull: typeof isNull; between: typeof between; notBetween: typeof notBetween; concat: typeof concat; merge: typeof concat; concatWith: typeof concatWith; mergeWith: typeof concatWith; columnName: (column: string) => string; booleanCond: typeof booleanCond; cond: typeof cond; regex: typeof regex; expr: typeof expr; size: typeof size; }; //# sourceMappingURL=expressions.d.ts.map