Skip to content

Commit fac6848

Browse files
committed
Base types, for convenience.
1 parent 5e155ba commit fac6848

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

base.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package sqldb
2+
3+
// BaseScript is a bare-minimum implementation of Script.
4+
type BaseScript struct {
5+
Text string
6+
Args []any
7+
}
8+
9+
func (this BaseScript) Statements() string {
10+
return this.Text
11+
}
12+
func (this BaseScript) Parameters() []any {
13+
return this.Args
14+
}
15+
16+
// BaseQuery is a bare-minium, partial implementation of Query.
17+
// Users are invited to embed it on types that define a Scan method,
18+
// thus completing the Query implementation.
19+
type BaseQuery struct {
20+
Text string
21+
Args []any
22+
}
23+
24+
func (this BaseQuery) Statement() string {
25+
return this.Text
26+
}
27+
func (this BaseQuery) Parameters() []any {
28+
return this.Args
29+
}

0 commit comments

Comments
 (0)