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.

  1. type Dialector interface {
  2. Name() string
  3. Initialize(*DB) error
  4. Migrator(db *DB) Migrator
  5. DataTypeOf(*schema.Field) string
  6. DefaultValueOf(*schema.Field) clause.Expression
  7. BindVarTo(writer clause.Writer, stmt *Statement, v interface{})
  8. QuoteTo(clause.Writer, string)
  9. Explain(sql string, vars ...interface{}) string
  10. }

Checkout the MySQL Driver as example