like method

List<ColumnComparisonWarning> like(
  1. ColumnDefinition other
)

Compares this column definition with other, returning a list of mismatches.

Implementation

List<ColumnComparisonWarning> like(ColumnDefinition other) {
  List<ColumnComparisonWarning> mismatches = [];

  if (name != other.name) {
    mismatches.add(
      ColumnComparisonWarning(
        name: name,
        expected: name,
        found: other.name,
      ),
    );
  }

  if (!columnType.like(other.columnType)) {
    mismatches.add(
      ColumnComparisonWarning(
        name: 'type',
        expected: '$columnType',
        found: '${other.columnType}',
      ),
    );
  }

  if (isNullable != other.isNullable) {
    mismatches.add(
      ColumnComparisonWarning(
        name: 'isNullable',
        expected: '$isNullable',
        found: '${other.isNullable}',
      ),
    );
  }

  if (columnDefault != other.columnDefault) {
    mismatches.add(
      ColumnComparisonWarning(
        name: 'default value',
        expected: '$columnDefault',
        found: '${other.columnDefault}',
      ),
    );
  }

  if (vectorDimension != other.vectorDimension) {
    mismatches.add(
      ColumnComparisonWarning(
        name: 'vector dimension',
        expected: '$vectorDimension',
        found: '${other.vectorDimension}',
      ),
    );
  }

  return mismatches;
}