shad-go/lectures/07-sql/sqlx/ext.go

24 lines
564 B
Go
Raw Normal View History

2020-04-09 11:15:34 +00:00
package sqlx
import (
2021-04-08 11:37:21 +00:00
"context"
"database/sql"
2020-04-09 11:15:34 +00:00
2021-04-08 11:37:21 +00:00
"github.com/jmoiron/sqlx"
2020-04-09 11:15:34 +00:00
)
2020-04-08 19:20:23 +00:00
type QueryerContext interface {
2021-04-08 11:37:21 +00:00
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryxContext(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error)
QueryRowxContext(ctx context.Context, query string, args ...interface{}) *sqlx.Row
2020-04-08 19:20:23 +00:00
}
type ExecerContext interface {
2021-04-08 11:37:21 +00:00
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
2020-04-08 19:20:23 +00:00
}
type ExtContext interface {
2021-04-08 11:37:21 +00:00
QueryerContext
ExecerContext
2020-04-08 19:20:23 +00:00
}