A CustomSqlType with access on the dialect of the database engine when used in queries.
This can be used to design drift types providing polyfills for types only
supported on some databases, for instance by using native DATE
support
on postgres but falling back to a textual representation on sqlite3.
Constructors
-
DialectAwareSqlType.via({required BaseSqlType<
T> fallback, required Map<SqlDialect, BaseSqlType< overrides})T> > -
Creates a DialectAwareSqlType that uses the
fallback
type by default, but can applyoverrides
on some database systems.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
-
mapToSqlLiteral(
GenerationContext context, T dartValue) → String -
Maps the
dartValue
to a SQL snippet that can be embedded as a literal into SQL queries generated by drift. -
mapToSqlParameter(
GenerationContext context, T dartValue) → Object -
Maps the
dartValue
to a value understood by the underlying database driver. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
SqlTypes typeSystem, Object fromSql) → T -
Interprets the underlying
fromSql
value from the database driver into the Dart representationT
of this type. -
sqlTypeName(
GenerationContext context) → String -
Returns a suitable representation of this type in SQL.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited