update address model link

This commit is contained in:
julian 2023-01-13 15:57:49 -06:00
parent 8a7236b46d
commit afdc496331
2 changed files with 50 additions and 3 deletions

View file

@ -27,7 +27,7 @@ class Address extends CryptoCurrencyAddress {
@enumerated @enumerated
late AddressSubType subType; late AddressSubType subType;
final transaction = IsarLink<Transaction>(); final transaction = IsarLinks<Transaction>();
int derivationChain() { int derivationChain() {
if (subType == AddressSubType.receiving) { if (subType == AddressSubType.receiving) {

View file

@ -83,7 +83,7 @@ const AddressSchema = CollectionSchema(
id: -7782495619063243587, id: -7782495619063243587,
name: r'transaction', name: r'transaction',
target: r'Transaction', target: r'Transaction',
single: true, single: false,
) )
}, },
embeddedSchemas: {}, embeddedSchemas: {},
@ -973,11 +973,58 @@ extension AddressQueryLinks
}); });
} }
QueryBuilder<Address, Address, QAfterFilterCondition> transactionIsNull() { QueryBuilder<Address, Address, QAfterFilterCondition>
transactionLengthEqualTo(int length) {
return QueryBuilder.apply(this, (query) {
return query.linkLength(r'transaction', length, true, length, true);
});
}
QueryBuilder<Address, Address, QAfterFilterCondition> transactionIsEmpty() {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
return query.linkLength(r'transaction', 0, true, 0, true); return query.linkLength(r'transaction', 0, true, 0, true);
}); });
} }
QueryBuilder<Address, Address, QAfterFilterCondition>
transactionIsNotEmpty() {
return QueryBuilder.apply(this, (query) {
return query.linkLength(r'transaction', 0, false, 999999, true);
});
}
QueryBuilder<Address, Address, QAfterFilterCondition>
transactionLengthLessThan(
int length, {
bool include = false,
}) {
return QueryBuilder.apply(this, (query) {
return query.linkLength(r'transaction', 0, true, length, include);
});
}
QueryBuilder<Address, Address, QAfterFilterCondition>
transactionLengthGreaterThan(
int length, {
bool include = false,
}) {
return QueryBuilder.apply(this, (query) {
return query.linkLength(r'transaction', length, include, 999999, true);
});
}
QueryBuilder<Address, Address, QAfterFilterCondition>
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<Address, Address, QSortBy> { extension AddressQuerySortBy on QueryBuilder<Address, Address, QSortBy> {