-
Notifications
You must be signed in to change notification settings - Fork 6
/
surrealdb.dart
46 lines (35 loc) · 946 Bytes
/
surrealdb.dart
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
import 'package:surrealdb/src/surrealdb.dart';
import 'package:surrealdb/surrealdb.dart';
void main(List<String> args) async {
final client = SurrealDB('ws://localhost:8000/rpc');
client.connect();
await client.wait();
await client.use('ns', 'db');
await client.signin('root', 'root');
final delete = await client.query('DELETE user:5');
print(delete);
client.close();
}
class AMODEL {
final String id;
final bool marketing;
final String title;
AMODEL(this.id, this.marketing, this.title);
static fromJson(Map<String, dynamic> json) {
return AMODEL(json['id'], json['marketing'], json['title']);
}
}
class TestModel {
final bool marketing;
final String title;
TestModel(this.marketing, this.title);
static fromJson(Map<String, dynamic> json) {
return TestModel(json['marketing'], json['title']);
}
toJson() {
return {
'marketing': marketing,
'title': title,
};
}
}