validateIntegrity method
- Insertable<
UserRow> instance, { - bool isInserting = false,
override
Validates that the given entity can be inserted into this table, meaning that it respects all constraints (nullability, text length, etc.).
Implementation
@override
VerificationContext validateIntegrity(Insertable<UserRow> instance,
{bool isInserting = false}) {
final context = VerificationContext();
final data = instance.toColumns(true);
if (data.containsKey('id')) {
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
} else if (isInserting) {
context.missing(_idMeta);
}
if (data.containsKey('num')) {
context.handle(
_numMeta, num.isAcceptableOrUnknown(data['num']!, _numMeta));
} else if (isInserting) {
context.missing(_numMeta);
}
if (data.containsKey('name')) {
context.handle(
_nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta));
}
if (data.containsKey('bio')) {
context.handle(
_bioMeta, bio.isAcceptableOrUnknown(data['bio']!, _bioMeta));
}
if (data.containsKey('avatar')) {
context.handle(_avatarMeta,
avatar.isAcceptableOrUnknown(data['avatar']!, _avatarMeta));
}
if (data.containsKey('call_cover')) {
context.handle(_callCoverMeta,
callCover.isAcceptableOrUnknown(data['call_cover']!, _callCoverMeta));
}
if (data.containsKey('mutual_contacts_count')) {
context.handle(
_mutualContactsCountMeta,
mutualContactsCount.isAcceptableOrUnknown(
data['mutual_contacts_count']!, _mutualContactsCountMeta));
}
if (data.containsKey('online')) {
context.handle(_onlineMeta,
online.isAcceptableOrUnknown(data['online']!, _onlineMeta));
}
if (data.containsKey('presence_index')) {
context.handle(
_presenceIndexMeta,
presenceIndex.isAcceptableOrUnknown(
data['presence_index']!, _presenceIndexMeta));
}
if (data.containsKey('status')) {
context.handle(_statusMeta,
status.isAcceptableOrUnknown(data['status']!, _statusMeta));
}
if (data.containsKey('is_deleted')) {
context.handle(_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta));
}
if (data.containsKey('dialog')) {
context.handle(_dialogMeta,
dialog.isAcceptableOrUnknown(data['dialog']!, _dialogMeta));
}
if (data.containsKey('is_blocked')) {
context.handle(_isBlockedMeta,
isBlocked.isAcceptableOrUnknown(data['is_blocked']!, _isBlockedMeta));
}
context.handle(_lastSeenAtMeta, const VerificationResult.success());
if (data.containsKey('contacts')) {
context.handle(_contactsMeta,
contacts.isAcceptableOrUnknown(data['contacts']!, _contactsMeta));
}
if (data.containsKey('ver')) {
context.handle(
_verMeta, ver.isAcceptableOrUnknown(data['ver']!, _verMeta));
} else if (isInserting) {
context.missing(_verMeta);
}
if (data.containsKey('blocked_ver')) {
context.handle(
_blockedVerMeta,
blockedVer.isAcceptableOrUnknown(
data['blocked_ver']!, _blockedVerMeta));
} else if (isInserting) {
context.missing(_blockedVerMeta);
}
if (data.containsKey('welcome_message')) {
context.handle(
_welcomeMessageMeta,
welcomeMessage.isAcceptableOrUnknown(
data['welcome_message']!, _welcomeMessageMeta));
}
return context;
}