gorm/dialects/mysql/mysql.go

34 lines
565 B
Go
Raw Normal View History

2020-02-02 03:35:01 +03:00
package mysql
import (
_ "github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
"github.com/jinzhu/gorm/callbacks"
)
type Dialector struct {
}
func Open(dsn string) gorm.Dialector {
return &Dialector{}
}
func (Dialector) Initialize(db *gorm.DB) error {
// register callbacks
callbacks.RegisterDefaultCallbacks(db)
return nil
}
func (Dialector) Migrator() gorm.Migrator {
return nil
}
func (Dialector) BindVar(stmt gorm.Statement, v interface{}) string {
return "?"
}
2020-02-05 06:14:58 +03:00
func (Dialector) QuoteChars() [2]byte {
return [2]byte{'`', '`'} // `name`
}