validateIntegrity method
- Insertable<
ChatItemRow> 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<ChatItemRow> 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('chat_id')) {
context.handle(_chatIdMeta,
chatId.isAcceptableOrUnknown(data['chat_id']!, _chatIdMeta));
} else if (isInserting) {
context.missing(_chatIdMeta);
}
if (data.containsKey('author_id')) {
context.handle(_authorIdMeta,
authorId.isAcceptableOrUnknown(data['author_id']!, _authorIdMeta));
} else if (isInserting) {
context.missing(_authorIdMeta);
}
context.handle(_atMeta, const VerificationResult.success());
context.handle(_statusMeta, const VerificationResult.success());
if (data.containsKey('data')) {
context.handle(
_dataMeta, this.data.isAcceptableOrUnknown(data['data']!, _dataMeta));
} else if (isInserting) {
context.missing(_dataMeta);
}
if (data.containsKey('cursor')) {
context.handle(_cursorMeta,
cursor.isAcceptableOrUnknown(data['cursor']!, _cursorMeta));
}
if (data.containsKey('ver')) {
context.handle(
_verMeta, ver.isAcceptableOrUnknown(data['ver']!, _verMeta));
} else if (isInserting) {
context.missing(_verMeta);
}
return context;
}