init
This commit is contained in:
commit
d69342b2e9
160 changed files with 28681 additions and 0 deletions
24
internal/tenant/queries.go
Normal file
24
internal/tenant/queries.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package tenant
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
type DB interface {
|
||||
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
|
||||
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
|
||||
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
|
||||
}
|
||||
|
||||
type Queries struct {
|
||||
db DB
|
||||
}
|
||||
|
||||
func NewQueries(db *sql.DB) *Queries {
|
||||
return &Queries{db: db}
|
||||
}
|
||||
|
||||
func (q *Queries) WithTx(tx *sql.Tx) *Queries {
|
||||
return &Queries{db: tx}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue