-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.dart
34 lines (29 loc) · 877 Bytes
/
test.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
import 'package:xata_dart/common.dart';
import 'package:xata_dart/main.dart';
import 'test/secret_testing_key.dart';
class MyModel extends XataRecord {
dynamic json;
MyModel.fromMap(Map<String, dynamic> map)
: json = map['json'] ?? "",
super.fromMap(map);
@override
Map<String, dynamic> toMap() {
return {
...super.toMap(),
"json": json,
};
}
}
void main() async {
final xata = Xata<MyModel>(key: secretKey);
xata.inWorkspace("Ali-Saleem-s-workspace-fddo4q");
xata.inRegion("us-east-1");
xata.inDatabase("ndb");
xata.inBranch("main");
xata.inTable("anothertable");
xata.withModel(MyModel.fromMap);
final res = await (xata).records.transaction([
XataOperation(get: XataGetOp(id: "rec_cs4c2d0hn78847taqjlg", columns: ["json", "something"]))
]);
print(await xata.records.get("rec_cs4c2d0hn78847taqjlg"));
}