Write Driver

Write new driver

GORM provides official support for sqlite, mysql, postgres, sqlserver.

Some databases may be compatible with the mysql or postgres dialect, in which case you could just use the dialect for those databases.

For others, you can create a new driver, it needs to implement the dialect interface.

type Dialector interface {
Name() string
Initialize(*DB) error
Migrator(db *DB) Migrator
DataTypeOf(*schema.Field) string
DefaultValueOf(*schema.Field) clause.Expression
BindVarTo(writer clause.Writer, stmt *Statement, v interface{})
QuoteTo(clause.Writer, string)
Explain(sql string, vars ...interface{}) string
}

Checkout the MySQL Driver as example

Platinum Sponsors

Become a Sponsor!

Platinum Sponsors

Become a Sponsor!

OpenCollective Sponsors