validateIntegrity method

  1. @override
VerificationContext validateIntegrity(
  1. Insertable<ChatItemViewRow> instance, {
  2. 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<ChatItemViewRow> instance,
    {bool isInserting = false}) {
  final context = VerificationContext();
  final data = instance.toColumns(true);
  if (data.containsKey('chat_id')) {
    context.handle(_chatIdMeta,
        chatId.isAcceptableOrUnknown(data['chat_id']!, _chatIdMeta));
  } else if (isInserting) {
    context.missing(_chatIdMeta);
  }
  if (data.containsKey('chat_item_id')) {
    context.handle(
        _chatItemIdMeta,
        chatItemId.isAcceptableOrUnknown(
            data['chat_item_id']!, _chatItemIdMeta));
  } else if (isInserting) {
    context.missing(_chatItemIdMeta);
  }
  return context;
}