gorm/tests/dummy_dialecter.go

35 lines
659 B
Go

package tests
import (
"github.com/jinzhu/gorm"
"github.com/jinzhu/gorm/logger"
"github.com/jinzhu/gorm/schema"
)
type DummyDialector struct {
}
func (DummyDialector) Initialize(*gorm.DB) error {
return nil
}
func (DummyDialector) Migrator(*gorm.DB) gorm.Migrator {
return nil
}
func (DummyDialector) BindVar(stmt *gorm.Statement, v interface{}) string {
return "?"
}
func (DummyDialector) QuoteChars() [2]byte {
return [2]byte{'`', '`'} // `name`
}
func (DummyDialector) Explain(sql string, vars ...interface{}) string {
return logger.ExplainSQL(sql, nil, `"`, vars...)
}
func (DummyDialector) DataTypeOf(*schema.Field) string {
return ""
}