interface.go 498 B

1234567891011121314151617181920
  1. package gorm
  2. import "database/sql"
  3. // SQLCommon is the minimal database connection functionality gorm requires. Implemented by *sql.DB.
  4. type SQLCommon interface {
  5. Exec(query string, args ...interface{}) (sql.Result, error)
  6. Prepare(query string) (*sql.Stmt, error)
  7. Query(query string, args ...interface{}) (*sql.Rows, error)
  8. QueryRow(query string, args ...interface{}) *sql.Row
  9. }
  10. type sqlDb interface {
  11. Begin() (*sql.Tx, error)
  12. }
  13. type sqlTx interface {
  14. Commit() error
  15. Rollback() error
  16. }