-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec_queryer.go
More file actions
50 lines (36 loc) · 1.17 KB
/
exec_queryer.go
File metadata and controls
50 lines (36 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package dbtyp
import (
"context"
"database/sql"
"github.com/kanmu/dbtyp/iface"
)
var _ iface.ExecQueryer = &ExecQueryer[struct{}]{}
type ExecQueryer[T any] struct {
i iface.ExecQueryer
}
// Interface implement
func (v *ExecQueryer[T]) Exec(query string, args ...any) (sql.Result, error) {
return v.i.Exec(query, args...)
}
func (v *ExecQueryer[T]) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) {
return v.i.ExecContext(ctx, query, args...)
}
func (v *ExecQueryer[T]) Query(query string, args ...any) (*sql.Rows, error) {
return v.i.Query(query, args...)
}
func (v *ExecQueryer[T]) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) {
return v.i.QueryContext(ctx, query, args...)
}
func (v *ExecQueryer[T]) QueryRow(query string, args ...any) *sql.Row {
return v.i.QueryRow(query, args...)
}
func (v *ExecQueryer[T]) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row {
return v.i.QueryRowContext(ctx, query, args...)
}
// Type converter
func (v *ExecQueryer[T]) Execer() *Execer[T] {
return &Execer[T]{i: v.i}
}
func (v *ExecQueryer[T]) Queryer() *Queryer[T] {
return &Queryer[T]{i: v.i}
}