Dart 渡槽框架按文档获取查询where
我想做http请求 例如,如何创建一个渡槽查询来获取jsonb列有值的行Dart 渡槽框架按文档获取查询where,dart,aqueduct,Dart,Aqueduct,我想做http请求 例如,如何创建一个渡槽查询来获取jsonb列有值的行 我只想获取location是斋浦尔的位置query.predicate=QueryPredicate(“content->'location'=@loc',{loc:location}) @Operation.get() Future<Response> getAllCoworking({@Bind.query('l') String location}) async { final query =
我只想获取location是斋浦尔的位置query.predicate=QueryPredicate(“content->'location'=@loc',{loc:location})
@Operation.get()
Future<Response> getAllCoworking({@Bind.query('l') String location}) async {
final query = Query<Coworking>(context);
/*if (location != null) {
query.where((x) => x.title).contains(
location,
caseSensitive: false,
);
}*/
query
..sortBy((w) => w.title, QuerySortOrder.ascending)
..fetchLimit = 5;
final coworkingList = await query.fetch();
return Response.ok(coworkingList);
}
[
{
"id": 1,
"title": "House of Words",
"content": {
"location": "Jaipur"
}
},
{
"id": 2,
"title": "T-START UDAIPUR",
"content": {
"location": "Udaipur"
}
},
{
"id": 3,
"title": "Thalagiri Co-Working Space",
"content": {
"location": "Udaipur"
}
}
]