validateIntegrity method

  1. @override
VerificationContext validateIntegrity(
  1. Insertable<CacheRow> 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<CacheRow> instance,
    {bool isInserting = false}) {
  final context = VerificationContext();
  final data = instance.toColumns(true);
  if (data.containsKey('checksum')) {
    context.handle(_checksumMeta,
        checksum.isAcceptableOrUnknown(data['checksum']!, _checksumMeta));
  } else if (isInserting) {
    context.missing(_checksumMeta);
  }
  return context;
}