validateIntegrity method

  1. @override
VerificationContext validateIntegrity(
  1. Insertable<TokenRow> 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<TokenRow> 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('credentials')) {
    context.handle(
        _credentialsMeta,
        credentials.isAcceptableOrUnknown(
            data['credentials']!, _credentialsMeta));
  } else if (isInserting) {
    context.missing(_credentialsMeta);
  }
  return context;
}