The base class for column types in databases.
This interface describes a logical, dialect-independent SQL type. The actual
type used in the underlying database is resolved to a PhysicalSqlType vi
resolveIn. That mapping is dialect-specific, and can even depend on
dialect options. For example, BuiltinSqlType.dateTime resolves to a text
or integer type for SQLite databases depending on a options.
- Available extensions
Constructors
-
SqlType.dialectSpecific({required SqlType<
T> fallback, required Map<KnownSqlDialect, SqlType< overrides})T> > -
Creates a SqlType implementation based on a
fallbacktype implementation used by default andoverridesused as fallbacks.constfactory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolveIn(
DriftDialect dialect) → PhysicalSqlType< T> - Resolves an implementation of the type in the given dialect.
-
sqlParameter(
DriftDialect dialect, T? value) → Object? -
Available on SqlType<
Maps a DartT> , provided by the TypeExtension extensionvalueto bind to a parameter in a generated statement to a value understood by database drivers. -
toString(
) → String -
A string representation of this object.
inherited
-
typeName(
DriftDialect dialect) → String -
Available on SqlType<
The name of the type in SQL, e.g. in a column definition or aT> , provided by the TypeExtension extensionCAST.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
bool
→ const SqlType<
bool> - A type suitable for storing boolean values.
-
byteArray
→ const SqlType<
Uint8List> - A type suitable for storing byte arrays as blobs.
-
dateTime
→ const SqlType<
DateTime> - A type suitable for storing datetime values.
-
double
→ const SqlType<
double> - A type suitable for storing double values.
-
int
→ const SqlType<
int> - A type suitable for storing 64-bit integers.
-
int64
→ const SqlType<
BigInt> - Guaranteed to be the same SQL type as int, but stores BigInt values to ensure we don't loose precision when compiling Dart to JavaScript (where ints are doubles).
-
json
→ const SqlType<
DatabaseJson> - A type suitable for storing JSON values.
-
text
→ const SqlType<
String> - A type suitable for storing text of arbitrary length.