File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 1212
1313 - name : " Checkout surrealdb.wasm repo (latest tag)"
1414 run : |
15- git clone https://github.com/limcheekin /surrealdb.wasm.git
16- # cd surrealdb.wasm;export LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
17- # git checkout $LATEST_TAG
15+ git clone https://github.com/surrealdb /surrealdb.wasm.git
16+ cd surrealdb.wasm;export LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
17+ git checkout $LATEST_TAG
1818
1919 - name : " Install Node & NPM"
2020 uses : actions/setup-node@v4
Original file line number Diff line number Diff line change @@ -136,8 +136,8 @@ DEFINE FIELD created ON document TYPE datetime;
136136 };
137137 final created = await db.create ('person' , data);
138138 final tom = Map <String , dynamic >.from (created! as Map );
139- final results = ( await db.select (tom['id' ] as String )) ! as List ;
140- final selectedTom = Map <String , dynamic >.from (results.first as Map );
139+ final result = await db.select (tom['id' ] as String );
140+ final selectedTom = Map <String , dynamic >.from (result ! as Map );
141141 expect (tom['name' ], equals (selectedTom['name' ]));
142142 });
143143
@@ -173,8 +173,8 @@ DEFINE FIELD created ON document TYPE datetime;
173173 final tom = Map <String , dynamic >.from (created! as Map );
174174 final id = tom['id' ] as String ;
175175 await db.delete (id);
176- final results = ( await db.select ('person' )) ! as List ;
177- expect (results, isEmpty );
176+ final result = await db.select ('person' );
177+ expect (result, isNull );
178178 });
179179
180180 testWidgets ('set test' , (WidgetTester tester) async {
Original file line number Diff line number Diff line change @@ -361,12 +361,16 @@ class Surreal {
361361 /// final person = await db.select('person:h5wxrf2ewk8xjxosxtyc');
362362 /// ```
363363 Future <Object ?> select (String resource) async {
364+ print ('** select resource $resource ' );
364365 final result = await promiseToFuture <Object ?>(
365366 _surreal.select (
366367 resource,
367368 ),
368369 );
369- return dartify (result)! as List ;
370+ print ('** select result $result ' );
371+ final list = dartify (result)! as List ;
372+ print ('** select list $list ' );
373+ return list.isEmpty ? null : (list.length == 1 ? list.first : list);
370374 }
371375
372376 /// Executes a SurrealQL query on the database.
@@ -419,7 +423,8 @@ class Surreal {
419423 resource,
420424 ),
421425 );
422- return dartify (result);
426+ final list = dartify (result)! as List ;
427+ return list.isEmpty ? null : (list.length == 1 ? list.first : list);
423428 }
424429
425430 /// Executes a transaction by calling the provided [action] function
You can’t perform that action at this time.
0 commit comments