CustomSqlType<T extends Object> class abstract interface

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 for details.





hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


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.
read(Object fromSql) → T
Interprets the underlying fromSql value from the database driver into the Dart representation T of this type.
sqlTypeName(GenerationContext context) String
Returns a suitable representation of this type in SQL.
toString() String
A string representation of this object.


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