validateIntegrity method

  1. @override
VerificationContext validateIntegrity(
  1. Insertable<CacheSummaryRow> 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<CacheSummaryRow> instance,
    {bool isInserting = false}) {
  final context = VerificationContext();
  final data = instance.toColumns(true);
  if (data.containsKey('id')) {
    context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
  }
  if (data.containsKey('size')) {
    context.handle(
        _sizeMeta, size.isAcceptableOrUnknown(data['size']!, _sizeMeta));
  }
  context.handle(_modifiedMeta, const VerificationResult.success());
  if (data.containsKey('max_size')) {
    context.handle(_maxSizeMeta,
        maxSize.isAcceptableOrUnknown(data['max_size']!, _maxSizeMeta));
  }
  return context;
}