gorm/interface.go

21 lines
498 B
Go
Raw Normal View History

2013-11-11 09:16:08 +04:00
package gorm
import "database/sql"
// SQLCommon is the minimal database connection functionality gorm requires. Implemented by *sql.DB.
type SQLCommon interface {
2013-11-11 09:16:08 +04:00
Exec(query string, args ...interface{}) (sql.Result, error)
Prepare(query string) (*sql.Stmt, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
QueryRow(query string, args ...interface{}) *sql.Row
}
2013-11-16 04:15:21 +04:00
type sqlDb interface {
2013-11-11 09:16:08 +04:00
Begin() (*sql.Tx, error)
}
2013-11-16 04:15:21 +04:00
type sqlTx interface {
2013-11-11 09:16:08 +04:00
Commit() error
Rollback() error
}