diff --git a/lib/models/isar/models/address/address.dart b/lib/models/isar/models/address/address.dart index 7d94a9315..bdddcb04a 100644 --- a/lib/models/isar/models/address/address.dart +++ b/lib/models/isar/models/address/address.dart @@ -27,7 +27,7 @@ class Address extends CryptoCurrencyAddress { @enumerated late AddressSubType subType; - final transaction = IsarLink(); + final transaction = IsarLinks(); int derivationChain() { if (subType == AddressSubType.receiving) { diff --git a/lib/models/isar/models/address/address.g.dart b/lib/models/isar/models/address/address.g.dart index 2f6098595..490c0618b 100644 --- a/lib/models/isar/models/address/address.g.dart +++ b/lib/models/isar/models/address/address.g.dart @@ -83,7 +83,7 @@ const AddressSchema = CollectionSchema( id: -7782495619063243587, name: r'transaction', target: r'Transaction', - single: true, + single: false, ) }, embeddedSchemas: {}, @@ -973,11 +973,58 @@ extension AddressQueryLinks }); } - QueryBuilder transactionIsNull() { + QueryBuilder + transactionLengthEqualTo(int length) { + return QueryBuilder.apply(this, (query) { + return query.linkLength(r'transaction', length, true, length, true); + }); + } + + QueryBuilder transactionIsEmpty() { return QueryBuilder.apply(this, (query) { return query.linkLength(r'transaction', 0, true, 0, true); }); } + + QueryBuilder + transactionIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.linkLength(r'transaction', 0, false, 999999, true); + }); + } + + QueryBuilder + transactionLengthLessThan( + int length, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.linkLength(r'transaction', 0, true, length, include); + }); + } + + QueryBuilder + transactionLengthGreaterThan( + int length, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.linkLength(r'transaction', length, include, 999999, true); + }); + } + + QueryBuilder + transactionLengthBetween( + int lower, + int upper, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.linkLength( + r'transaction', lower, includeLower, upper, includeUpper); + }); + } } extension AddressQuerySortBy on QueryBuilder {