2020-02-05 06:14:58 +03:00
|
|
|
package tests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/jinzhu/gorm"
|
2020-03-09 12:07:00 +03:00
|
|
|
"github.com/jinzhu/gorm/clause"
|
2020-02-23 10:07:47 +03:00
|
|
|
"github.com/jinzhu/gorm/logger"
|
2020-02-22 15:57:29 +03:00
|
|
|
"github.com/jinzhu/gorm/schema"
|
2020-02-05 06:14:58 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type DummyDialector struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (DummyDialector) Initialize(*gorm.DB) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-02-22 15:57:29 +03:00
|
|
|
func (DummyDialector) Migrator(*gorm.DB) gorm.Migrator {
|
2020-02-05 06:14:58 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-03-09 12:59:54 +03:00
|
|
|
func (DummyDialector) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{}) {
|
|
|
|
writer.WriteByte('?')
|
2020-02-05 06:14:58 +03:00
|
|
|
}
|
|
|
|
|
2020-03-09 12:07:00 +03:00
|
|
|
func (DummyDialector) QuoteTo(writer clause.Writer, str string) {
|
|
|
|
writer.WriteByte('`')
|
|
|
|
writer.WriteString(str)
|
|
|
|
writer.WriteByte('`')
|
2020-02-05 06:14:58 +03:00
|
|
|
}
|
2020-02-22 15:57:29 +03:00
|
|
|
|
2020-02-23 10:07:47 +03:00
|
|
|
func (DummyDialector) Explain(sql string, vars ...interface{}) string {
|
|
|
|
return logger.ExplainSQL(sql, nil, `"`, vars...)
|
|
|
|
}
|
|
|
|
|
2020-02-22 15:57:29 +03:00
|
|
|
func (DummyDialector) DataTypeOf(*schema.Field) string {
|
|
|
|
return ""
|
|
|
|
}
|