2020-02-02 03:35:01 +03:00
|
|
|
package sqlite
|
|
|
|
|
|
|
|
import (
|
2020-02-02 09:40:44 +03:00
|
|
|
"github.com/jinzhu/gorm"
|
2020-02-02 03:35:01 +03:00
|
|
|
"github.com/jinzhu/gorm/callbacks"
|
|
|
|
_ "github.com/mattn/go-sqlite3"
|
|
|
|
)
|
|
|
|
|
|
|
|
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 "?"
|
|
|
|
}
|