TableScheme class

A generic table scheme.

Constructors

TableScheme(String name, {required String? idFieldName, required Map<String, Type> fieldsTypes, Map<String, TableFieldReference> fieldsReferencedTables = const <String, TableFieldReference>{}, Iterable<TableRelationshipReference>? relationshipTables, Iterable<TableConstraint>? constraints, bool relationship = false, Map<String, List<String>>? indexes, Iterable<String>? uniqueIndexes, Map<String, TableEnumConstraint>? checkConstraints, String? primaryKeyIndex, Map<String, String>? indexesKinds})

Properties

checkConstraints → Map<String, TableEnumConstraint>?
The table's enum CHECK constraints, by constraint name; null if unknown (the adapter doesn't provide them). Unlike constraints, two over the same column aren't merged.
final
constraints → Set<TableConstraint>
Table constraints.
final
duplicatedCheckConstraints → Map<String, List<String>>?
The checkConstraints over the same column (case insensitive): by column, the constraints names (sorted). null if the checkConstraints are unknown.
no setter
duplicatedIndexes → List<List<String>>?
The indexes over the same columns (in the same order, case insensitive) and of the same kind (indexesKinds): each group's names sorted, the groups by their first name. null if the indexes are unknown.
no setter
fieldsNames → List<String>
Table fields names.
final
fieldsReferencedTables → Map<String, TableFieldReference>
no setter
fieldsReferencedTablesLength → int
Returns _fieldsReferencedTables length.
no setter
fieldsTypes → Map<String, Type>
Fields types.
final
hashCode → int
The hash code for this object.
no setterinherited
hasTableReferences → bool
no setter
idFieldName → String?
The ID field name.
final
indexes → Map<String, List<String>>?
The table's indexes: by index name, its columns (in order); null if unknown (the adapter doesn't provide them).
final
indexesKinds → Map<String, String>?
How each of the indexes indexes its columns, by index name: an adapter's description (e.g. the method, operator classes, order, INCLUDE columns), only compared for equality. Indexes over the same columns of different kinds (e.g. a btree and a GIN index) aren't duplicates. null (or an index without one): unknown, a plain index.
final
name → String
The table name
final
primaryKeyIndex → String?
The name of the index of the primary key (of the indexes); null if unknown or none.
final
relationship → bool
If true is a relationship table.
final
relationshipTables → Set<TableRelationshipReference>
no setter
relationshipTablesLength → int
Returns _relationshipTables length.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tableRelationshipReference → Map<String, List<TableRelationshipReference>>
Returns _tableRelationshipReference.
no setter
tableRelationshipReferenceLength → int
Returns _tableRelationshipReference length.
no setter
uniqueIndexes → Set<String>?
The names of the unique indexes (also the ones of UNIQUE and PRIMARY KEY constraints); null if unknown.
final

Methods

buildFieldsNamesIndexes(List<String> fieldsNames) → Map<String, int>
inherited
buildFieldsNamesLC(List<String> fieldsNames) → List<String>
inherited
buildFieldsNamesSimple(List<String> fieldsNames) → List<String>
inherited
fieldToLCKey(String key) → String
inherited
fieldToSimpleKey(String key) → String
inherited
getFieldKeyInMap(String field, Map<String, Object?> map, {String? fieldLC, String? fieldSimple, Map<String, String>? mapLC, Map<String, String>? mapSimple}) → String?
Returns a field key from map.
inherited
getFieldReferencedTable(String fieldKey) → TableFieldReference?
Returns a TableFieldReference from _fieldsReferencedTables with a resolved fieldKey. See resolveTableFieldName.
getFieldsKeysInMap(List<String> fields, Map<String, Object?> map, {String? fieldLC, String? fieldSimple, Map<String, String>? mapLC, Map<String, String>? mapSimple}) → Map<String, String?>
Returns a Map of field keys from map.
inherited
getFieldsValues(Map<String, Object?> map, {Iterable<String>? fields}) → Map<String, Object?>
Returns a Map with the table fields values populated from the provided map.
getFieldsValuesFromMap(List<String> fieldsNames, Map<String, Object?> map, {Map<String, int>? fieldsNamesIndexes, List<String>? fieldsNamesLC, List<String>? fieldsNamesSimple, bool includeAbsentFields = false, List<String>? returnMapUsedKeys}) → Map<String, Object?>
Returns a Map with the fields values populated from the provided map.
inherited
getFieldValueFromMap(String field, Map<String, Object?> map, {String? fieldLC, String? fieldSimple, Map<String, String>? mapLC, Map<String, String>? mapSimple}) → Object?
Returns a field value from map.
inherited
getTableRelationshipReference({String? sourceTable, String? sourceField, String? targetTable}) → TableRelationshipReference?
Returns the TableRelationshipReference with the targetTable.
hasIndexOn(List<String> columns, {bool unique = false}) → bool?
Whether the table has an index over exactly columns (in this order, any name), a unique one if unique. null if the indexes (or the uniqueIndexes) are unknown.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveFiledName(List<String> fieldsNames, String fieldName, {Map<String, int>? fieldsNamesIndexes, List<String>? fieldsNamesLC, List<String>? fieldsNamesSimple, bool includeAbsentFields = false, List<String>? returnMapUsedKeys}) → String?
Resolves fieldName to one that matches a fieldsNames element.
inherited
resolveTableFieldName(String key) → String?
Resolves key to a matching field in fieldsNames.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited