Skip to content

Commit 0651a31

Browse files
authored
Merge pull request #268 from appwrite/dev
Add time between queries
2 parents e061bca + f644d26 commit 0651a31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+804
-713
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## 19.0.0
4+
5+
* Rename `CreditCard` enum value `unionChinaPay` to `unionPay`
6+
* Add time between query support
7+
* Add spatial query support
8+
39
## 18.0.0
410

511
* Support for Appwrite 1.8

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:
2121

2222
```yml
2323
dependencies:
24-
appwrite: ^18.0.0
24+
appwrite: ^19.0.0
2525
```
2626
2727
You can install packages from the command line:

docs/examples/account/update-prefs.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@ Client client = Client()
77
Account account = Account(client);
88

99
User result = await account.updatePrefs(
10-
prefs: {},
10+
prefs: {
11+
"language": "en",
12+
"timezone": "UTC",
13+
"darkTheme": true
14+
},
1115
);

docs/examples/databases/create-document.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Document result = await databases.createDocument(
1010
databaseId: '<DATABASE_ID>',
1111
collectionId: '<COLLECTION_ID>',
1212
documentId: '<DOCUMENT_ID>',
13-
data: {},
13+
data: {
14+
"username": "walter.obrien",
15+
"email": "walter.obrien@example.com",
16+
"fullName": "Walter O'Brien",
17+
"age": 30,
18+
"isAdmin": false
19+
},
1420
permissions: ["read("any")"], // optional
1521
);

docs/examples/tablesdb/create-row.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Row result = await tablesDB.createRow(
1010
databaseId: '<DATABASE_ID>',
1111
tableId: '<TABLE_ID>',
1212
rowId: '<ROW_ID>',
13-
data: {},
13+
data: {
14+
"username": "walter.obrien",
15+
"email": "walter.obrien@example.com",
16+
"fullName": "Walter O'Brien",
17+
"age": 30,
18+
"isAdmin": false
19+
},
1420
permissions: ["read("any")"], // optional
1521
);

lib/query.dart

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@ class Query {
99
Query._(this.method, [this.attribute = null, this.values = null]);
1010

1111
Map<String, dynamic> toJson() {
12-
final map = <String, dynamic>{'method': method};
12+
final result = <String, dynamic>{};
13+
14+
result['method'] = method;
1315

1416
if (attribute != null) {
15-
map['attribute'] = attribute;
17+
result['attribute'] = attribute;
1618
}
1719

1820
if (values != null) {
19-
map['values'] = values is List ? values : [values];
21+
result['values'] = values is List ? values : [values];
2022
}
2123

22-
return map;
24+
return result;
2325
}
2426

2527
@override
@@ -35,7 +37,7 @@ class Query {
3537

3638
/// Filter resources where [attribute] is not equal to [value].
3739
static String notEqual(String attribute, dynamic value) =>
38-
Query._('notEqual', attribute, [value]).toString();
40+
Query._('notEqual', attribute, value).toString();
3941

4042
/// Filter resources where [attribute] is less than [value].
4143
static String lessThan(String attribute, dynamic value) =>
@@ -111,6 +113,10 @@ class Query {
111113
static String createdAfter(String value) =>
112114
Query._('createdAfter', null, value).toString();
113115

116+
/// Filter resources where document was created between [start] and [end] (inclusive).
117+
static String createdBetween(String start, String end) =>
118+
Query._('createdBetween', null, [start, end]).toString();
119+
114120
/// Filter resources where document was updated before [value].
115121
static String updatedBefore(String value) =>
116122
Query._('updatedBefore', null, value).toString();
@@ -119,6 +125,10 @@ class Query {
119125
static String updatedAfter(String value) =>
120126
Query._('updatedAfter', null, value).toString();
121127

128+
/// Filter resources where document was updated between [start] and [end] (inclusive).
129+
static String updatedBetween(String start, String end) =>
130+
Query._('updatedBetween', null, [start, end]).toString();
131+
122132
static String or(List<String> queries) => Query._(
123133
'or',
124134
null,
@@ -166,4 +176,68 @@ class Query {
166176
/// docs for more information.
167177
static String offset(int offset) =>
168178
Query._('offset', null, offset).toString();
179+
180+
/// Filter resources where [attribute] is at a specific distance from the given coordinates.
181+
static String distanceEqual(
182+
String attribute, List<dynamic> values, num distance,
183+
[bool meters = true]) =>
184+
Query._('distanceEqual', attribute, [
185+
[values, distance, meters]
186+
]).toString();
187+
188+
/// Filter resources where [attribute] is not at a specific distance from the given coordinates.
189+
static String distanceNotEqual(
190+
String attribute, List<dynamic> values, num distance,
191+
[bool meters = true]) =>
192+
Query._('distanceNotEqual', attribute, [
193+
[values, distance, meters]
194+
]).toString();
195+
196+
/// Filter resources where [attribute] is at a distance greater than the specified value from the given coordinates.
197+
static String distanceGreaterThan(
198+
String attribute, List<dynamic> values, num distance,
199+
[bool meters = true]) =>
200+
Query._('distanceGreaterThan', attribute, [
201+
[values, distance, meters]
202+
]).toString();
203+
204+
/// Filter resources where [attribute] is at a distance less than the specified value from the given coordinates.
205+
static String distanceLessThan(
206+
String attribute, List<dynamic> values, num distance,
207+
[bool meters = true]) =>
208+
Query._('distanceLessThan', attribute, [
209+
[values, distance, meters]
210+
]).toString();
211+
212+
/// Filter resources where [attribute] intersects with the given geometry.
213+
static String intersects(String attribute, List<dynamic> values) =>
214+
Query._('intersects', attribute, [values]).toString();
215+
216+
/// Filter resources where [attribute] does not intersect with the given geometry.
217+
static String notIntersects(String attribute, List<dynamic> values) =>
218+
Query._('notIntersects', attribute, [values]).toString();
219+
220+
/// Filter resources where [attribute] crosses the given geometry.
221+
static String crosses(String attribute, List<dynamic> values) =>
222+
Query._('crosses', attribute, [values]).toString();
223+
224+
/// Filter resources where [attribute] does not cross the given geometry.
225+
static String notCrosses(String attribute, List<dynamic> values) =>
226+
Query._('notCrosses', attribute, [values]).toString();
227+
228+
/// Filter resources where [attribute] overlaps with the given geometry.
229+
static String overlaps(String attribute, List<dynamic> values) =>
230+
Query._('overlaps', attribute, [values]).toString();
231+
232+
/// Filter resources where [attribute] does not overlap with the given geometry.
233+
static String notOverlaps(String attribute, List<dynamic> values) =>
234+
Query._('notOverlaps', attribute, [values]).toString();
235+
236+
/// Filter resources where [attribute] touches the given geometry.
237+
static String touches(String attribute, List<dynamic> values) =>
238+
Query._('touches', attribute, [values]).toString();
239+
240+
/// Filter resources where [attribute] does not touch the given geometry.
241+
static String notTouches(String attribute, List<dynamic> values) =>
242+
Query._('notTouches', attribute, [values]).toString();
169243
}

0 commit comments

Comments
 (0)