2013-11-14 13:35:17 +04:00
|
|
|
package dialect
|
|
|
|
|
|
|
|
type Dialect interface {
|
2013-11-15 07:36:27 +04:00
|
|
|
BinVar() string
|
2013-11-14 14:59:11 +04:00
|
|
|
SupportLastInsertId() bool
|
|
|
|
SqlTag(column interface{}, size int) string
|
|
|
|
PrimaryKeyTag(column interface{}, size int) string
|
|
|
|
ReturningStr(key string) string
|
2013-11-14 13:35:17 +04:00
|
|
|
}
|
|
|
|
|
2013-11-14 14:59:11 +04:00
|
|
|
func NewDialect(driver string) Dialect {
|
2013-11-14 13:35:17 +04:00
|
|
|
var d Dialect
|
|
|
|
switch driver {
|
|
|
|
case "postgres":
|
2013-11-14 14:59:11 +04:00
|
|
|
d = &postgres{}
|
2013-11-14 13:35:17 +04:00
|
|
|
case "mysql":
|
2013-11-14 14:59:11 +04:00
|
|
|
d = &mysql{}
|
2013-11-14 13:35:17 +04:00
|
|
|
case "sqlite3":
|
2013-11-14 14:59:11 +04:00
|
|
|
d = &sqlite3{}
|
2013-11-14 13:35:17 +04:00
|
|
|
}
|
2013-11-14 14:59:11 +04:00
|
|
|
return d
|
2013-11-14 13:35:17 +04:00
|
|
|
}
|