From 5131f22982d726192df93d0176b142ad43667345 Mon Sep 17 00:00:00 2001 From: "CaptainDario @ MBP M1" Date: Sun, 28 May 2023 23:18:55 +0200 Subject: [PATCH] use hashElements index for where clause --- .../lib/src/krad/data_classes.dart | 2 +- .../lib/src/krad/data_classes.g.dart | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/database_builder/lib/src/krad/data_classes.dart b/database_builder/lib/src/krad/data_classes.dart index 01d27eb..2d1cd4a 100644 --- a/database_builder/lib/src/krad/data_classes.dart +++ b/database_builder/lib/src/krad/data_classes.dart @@ -14,7 +14,7 @@ class Krad { /// This entries radical character @Index() String character; - @Index() + @Index(type: IndexType.hashElements) List kanjis = []; /// The stroke count of this radical @Index() diff --git a/database_builder/lib/src/krad/data_classes.g.dart b/database_builder/lib/src/krad/data_classes.g.dart index 37a5d80..216efa2 100644 --- a/database_builder/lib/src/krad/data_classes.g.dart +++ b/database_builder/lib/src/krad/data_classes.g.dart @@ -60,7 +60,7 @@ const KradSchema = CollectionSchema( properties: [ IndexPropertySchema( name: r'kanjis', - type: IndexType.hash, + type: IndexType.hashElements, caseSensitive: true, ) ], @@ -287,30 +287,30 @@ extension KradQueryWhere on QueryBuilder { }); } - QueryBuilder kanjisEqualTo( - List kanjis) { + QueryBuilder kanjisElementEqualTo( + String kanjisElement) { return QueryBuilder.apply(this, (query) { return query.addWhereClause(IndexWhereClause.equalTo( indexName: r'kanjis', - value: [kanjis], + value: [kanjisElement], )); }); } - QueryBuilder kanjisNotEqualTo( - List kanjis) { + QueryBuilder kanjisElementNotEqualTo( + String kanjisElement) { return QueryBuilder.apply(this, (query) { if (query.whereSort == Sort.asc) { return query .addWhereClause(IndexWhereClause.between( indexName: r'kanjis', lower: [], - upper: [kanjis], + upper: [kanjisElement], includeUpper: false, )) .addWhereClause(IndexWhereClause.between( indexName: r'kanjis', - lower: [kanjis], + lower: [kanjisElement], includeLower: false, upper: [], )); @@ -318,14 +318,14 @@ extension KradQueryWhere on QueryBuilder { return query .addWhereClause(IndexWhereClause.between( indexName: r'kanjis', - lower: [kanjis], + lower: [kanjisElement], includeLower: false, upper: [], )) .addWhereClause(IndexWhereClause.between( indexName: r'kanjis', lower: [], - upper: [kanjis], + upper: [kanjisElement], includeUpper: false, )); }