-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.d.ts
215 lines (215 loc) · 6.11 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/// <reference types="realm" />
import { Results } from 'realm';
export declare type ILogicOperator = 'AND' | 'OR';
export declare type EqualValueType = string | number | boolean | Date;
export declare type CompareValueType = number | Date;
export declare type CriteriaFunc = { (pladholders: string[]): string };
export declare type CriteriaFuncWrapper = { (): string };
declare class RealmQuery {
private objects;
protected criteria: any[];
protected values: any[]; // Values to be bound to query. Deferred appending till binding done in toString()
private inGroup;
private sortField;
private sortReverse;
constructor(objects?: Results<any>);
addCriteria(critera: CriteriaFunc, criteriaValues: any[] ): RealmQuery;
private getFilteredObjects();
toString(): string;
/**
* Returns the average of a given field
* @param fieldName {string}
* @return {number}
*/
average(fieldName: string): number;
/**
* Begin grouping of conditions ("left parenthesis")
*
* @return {RealmQuery}
*/
beginGroup(): RealmQuery;
/**
* Condition that the value of field begins with the specified string
*
* @param fieldName {string}
* @param value {string}
* @param casing {boolean, optional} BEGINSWITH[c] or BEGINSWITH
*/
beginsWith(fieldName: string, value: string, casing?: boolean): RealmQuery;
/**
* Between condition
*
* @param fieldName {string}
* @param from {CompareValueType}
* @param to {CompareValueType}
* @return {RealmQuery}
*/
between(fieldName: string, from: CompareValueType, to: CompareValueType): RealmQuery;
/**
* Condition that value of field contains the specified substring
*
* @param fieldName {string}
* @param value {string}
* @param casing {boolean, optional} CONTAINS[c] or CONTAINS
*/
contains(fieldName: string, value: string, casing?: boolean): RealmQuery;
/**
* Counts the number of objects that fulfill the query conditions
*
* @return {number}
*/
count(): number;
/**
* Returns a distinct set of objects of a specific class.
*
* @param fieldName {string}
* @return {any[]}
*/
distinct(fieldName: string): Array<any>;
/**
* End grouping of conditions ("right parenthesis") which was opened by a call to beginGroup()
* @return {RealmQuery}
*/
endGroup(): RealmQuery;
/**
* Condition that the value of field ends with the specified string
*
* @param fieldName {string}
* @param value {string}
* @param casing {boolean, optional} ENDSWITH[c] or ENDSWITH
* @return {RealmQuery}
*/
endsWith(fieldName: string, value: string, casing?: boolean): RealmQuery;
/**
* Equal-to comparison
*
* @param fieldName {string}
* @param value {EqualValueType}
* @return {RealmQuery}
*/
equalTo(fieldName: string, value: EqualValueType): RealmQuery;
/**
* Finds all objects that fulfill the query conditions
* @return {Results}
*/
findAll<M>(): Results<M>;
/**
* Finds the first object that fulfills the query conditions
*/
findFirst<M>(): M;
/**
* Greater-than comparison
*
* @param fieldName {string}
* @param value {CompareValueType}
* @return {RealmQuery}
*/
greaterThan(fieldName: string, value: CompareValueType): RealmQuery;
/**
* greater-than-or-equal-to comparison
*
* @param fieldName {string}
* @param value {CompareValueType}
* @return {RealmQuery}
*/
greaterThanOrEqualTo(fieldName: string, value: CompareValueType): RealmQuery;
/**
* In comparison
*
* @param fieldName {string}
* @param values {EqualValueType[]}
* @return {RealmQuery}
*/
in(fieldName: string, values: EqualValueType[]): RealmQuery;
isEmpty(fieldName: string): RealmQuery;
isNotEmpty(fieldName: string): RealmQuery;
isNotNull(fieldName: string): RealmQuery;
isNull(fieldName: string): RealmQuery;
/**
* Less-than comparison
*
* @param fieldName {string}
* @param value {CompareValueType}
* @return {RealmQuery}
*/
lessThan(fieldName: string, value: CompareValueType): RealmQuery;
/**
* Less-than-or-equal-to comparison
*
* @param fieldName {string}
* @param value {CompareValueType}
* @return {RealmQuery}
*/
lessThanOrEqualTo(fieldName: string, value: CompareValueType): RealmQuery;
/**
*
* @param fieldName
* @param value
*/
like(fieldName: string, value: string): RealmQuery;
/**
* Finds the maximum value of a field
*
* @param fieldName {string}
* @return {any}
*/
max(fieldName: string): any;
/**
* Finds the miniimum value of a field
*
* @param fieldName {string}
* @return {any}
*/
min(fieldName: string): any;
not(): RealmQuery;
/**
* Not-equal-to comparison
*
* @param fieldName {string}
* @param value {EqualValueType}
* @return {RealmQuery}
*/
notEqualTo(fieldName: string, value: EqualValueType): RealmQuery;
/**
* AND logic operator. Use in group
*
* @return {RealmQuery}
*/
and(): RealmQuery;
/**
* OR logic operator. Use in group
*
* @return {RealmQuery}
*/
or(): RealmQuery;
/**
* Calculates the sum of a given field
*
* @param fieldName {string}
* @return {number}
*/
sum(fieldName: string): number;
/**
* Set sorted into realm.objects
*
* @param fieldName {string}
* @param order {ASC|DESC}
* @return {RealmQuery}
*/
sort(fieldName: string, order?: 'ASC' | 'DESC'): RealmQuery;
/**
* Combine to another query
*/
join(query: any): RealmQuery;
/**
* Create new query
* @param objects {Realm.Collection}
*/
static where(objects: Results<any>): RealmQuery;
/**
* Create new query. Alias of where
* @param objects {Realm.Collection}
*/
static create(objects?: Results<any>): RealmQuery;
}
export default RealmQuery;