Codebase list golang-github-jinzhu-gorm / ac6b755c-3c49-4ae5-a19f-fc888a9d87c4/main interface.go
ac6b755c-3c49-4ae5-a19f-fc888a9d87c4/main

Tree @ac6b755c-3c49-4ae5-a19f-fc888a9d87c4/main (Download .tar.gz)

interface.go @ac6b755c-3c49-4ae5-a19f-fc888a9d87c4/mainraw · history · blame

package gorm

import (
	"context"
	"database/sql"
)

// SQLCommon is the minimal database connection functionality gorm requires.  Implemented by *sql.DB.
type SQLCommon interface {
	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
}

type sqlDb interface {
	Begin() (*sql.Tx, error)
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}

type sqlTx interface {
	Commit() error
	Rollback() error
}