Skip to content

Commit

Permalink
update: *DB and Tx implement tha same interface "QueryExecuter"
Browse files Browse the repository at this point in the history
  • Loading branch information
toyohashi6140 committed Nov 19, 2023
1 parent 8a43835 commit e299c3a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,31 @@ func WithDiscardUnknownColumns() DBOption {
}
}

// *DB & Tx implemenet the same interface
type QueryExecuter interface {
NewValues(interface{}) *ValuesQuery
NewMerge() *MergeQuery
NewSelect() *SelectQuery
NewInsert() *InsertQuery
NewUpdate() *UpdateQuery
NewDelete() *DeleteQuery
NewRaw(string, ...interface{}) *RawQuery
NewCreateTable() *CreateTableQuery
NewDropTable() *DropTableQuery
NewCreateIndex() *CreateIndexQuery
NewDropIndex() *DropIndexQuery
NewTruncateTable() *TruncateTableQuery
NewAddColumn() *AddColumnQuery
NewDropColumn() *DropColumnQuery
Dialect() schema.Dialect
Query(string, ...interface{}) (*sql.Rows, error)
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
QueryRow(string, ...interface{}) *sql.Row
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
Exec(string, ...interface{}) (sql.Result, error)
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
}

type DB struct {
*sql.DB

Expand Down

0 comments on commit e299c3a

Please sign in to comment.