validateIntegrity method

  1. @override
VerificationContext validateIntegrity(
  1. Insertable<ChatMemberRow> 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<ChatMemberRow> instance,
    {bool isInserting = false}) {
  final context = VerificationContext();
  final data = instance.toColumns(true);
  if (data.containsKey('user_id')) {
    context.handle(_userIdMeta,
        userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta));
  } else if (isInserting) {
    context.missing(_userIdMeta);
  }
  if (data.containsKey('chat_id')) {
    context.handle(_chatIdMeta,
        chatId.isAcceptableOrUnknown(data['chat_id']!, _chatIdMeta));
  } else if (isInserting) {
    context.missing(_chatIdMeta);
  }
  context.handle(_joinedAtMeta, const VerificationResult.success());
  if (data.containsKey('cursor')) {
    context.handle(_cursorMeta,
        cursor.isAcceptableOrUnknown(data['cursor']!, _cursorMeta));
  }
  return context;
}