[][src]Derive Macro diesel::sql_types::SqlType

#[derive(SqlType)]
{
    // Attributes available to this derive:
    #[postgres]
    #[sqlite_type]
    #[mysql_type]
}

Implement necessary traits for adding a new sql type

This trait implements all necessary traits to define a new sql type. This is useful for adding support for unsupported or custom types on sql side. The sql type will be usable for all backends you specified via the attributes listed below.

This derive will implement NotNull, HasSqlType and SingleValue. When using this deriving, you need to specify how the type is represented on various backends. You don't need to specify every backend, only the ones supported by your type.

For PostgreSQL, add #[postgres(type_name = "pg_type_name")] or #[postgres(oid = "some_oid", array_oid = "some_oid")] for builtin types. For MySQL, specify which variant of MysqlType should be used by adding #[mysql_type = "Variant"]. For SQLite, specify which variant of SqliteType should be used by adding #[sqlite_type = "Variant"].

Attributes

Type attributes