validateIntegrity method

  1. @override
VerificationContext validateIntegrity(
  1. Insertable<GeoLocationRow> 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<GeoLocationRow> instance,
    {bool isInserting = false}) {
  final context = VerificationContext();
  final data = instance.toColumns(true);
  if (data.containsKey('ip')) {
    context.handle(_ipMeta, ip.isAcceptableOrUnknown(data['ip']!, _ipMeta));
  } else if (isInserting) {
    context.missing(_ipMeta);
  }
  if (data.containsKey('data')) {
    context.handle(
        _dataMeta, this.data.isAcceptableOrUnknown(data['data']!, _dataMeta));
  } else if (isInserting) {
    context.missing(_dataMeta);
  }
  if (data.containsKey('language')) {
    context.handle(_languageMeta,
        language.isAcceptableOrUnknown(data['language']!, _languageMeta));
  }
  context.handle(_updatedAtMeta, const VerificationResult.success());
  return context;
}