Interface for a custom SQL type.
Being designed with sqlite3 as its primary database engine, drift lacks builtin support for the rich type system found in more complex database systems like postgres. By providing the CustomSqlType interface, drift can be extended to support any database type by customizing the way these types are mapped from and to the database.
To create a custom type, implement this interface. You can now create values of this type by passing it to Constant or Variable, Expression.cast and other methods operating on types. Custom types can also be applied to table columns, see https://drift.simonbinder.eu/docs/sql-api/types/ for details.
Constructors
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(
T dartValue) → String -
Maps the
dartValue
to a SQL snippet that can be embedded as a literal into SQL queries generated by drift. -
mapToSqlParameter(
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(
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