Skip to content

Commit be5e6ac

Browse files
authored
Add default adapter Name implementation (#59)
* Add default adapter DBType implementation * Rename DBType to Name * Update go-rel/rel dependency
1 parent 59ff908 commit be5e6ac

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.21
55
toolchain go1.21.0
66

77
require (
8-
github.com/go-rel/rel v0.40.0
8+
github.com/go-rel/rel v0.40.1-0.20231007112841-2e07fc196025
99
github.com/stretchr/testify v1.8.4
1010
)
1111

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
33
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
44
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
55
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
6-
github.com/go-rel/rel v0.40.0 h1:Av2/Ub6fQn6UbwxTIHStfLb7W+knRhOVX8AWcC+pOBA=
7-
github.com/go-rel/rel v0.40.0/go.mod h1:6opWRxsoHoDq67fIDnsmcmnojpskWpPqCs0AoL/UrEU=
6+
github.com/go-rel/rel v0.40.1-0.20231007112841-2e07fc196025 h1:Gq1za5TzJT5h7ByoaSYsKpcMJ5QcRvW7aJwBUJZNLcc=
7+
github.com/go-rel/rel v0.40.1-0.20231007112841-2e07fc196025/go.mod h1:6opWRxsoHoDq67fIDnsmcmnojpskWpPqCs0AoL/UrEU=
88
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
99
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
1010
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=

sql.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ type SQL struct {
3333
Instrumenter rel.Instrumenter
3434
}
3535

36+
// Name returns database adapter name.
37+
func (s SQL) Name() string {
38+
return "sql"
39+
}
40+
3641
// Instrumentation set instrumenter for this adapter.
3742
func (s *SQL) Instrumentation(instrumenter rel.Instrumenter) {
3843
s.Instrumenter = instrumenter
@@ -173,10 +178,7 @@ func (s SQL) Query(ctx context.Context, query rel.Query) (rel.Cursor, error) {
173178

174179
// Exec performs exec operation.
175180
func (s SQL) Exec(ctx context.Context, statement string, args []any) (int64, int64, error) {
176-
var (
177-
res, err = s.DoExec(ctx, statement, args)
178-
)
179-
181+
res, err := s.DoExec(ctx, statement, args)
180182
if err != nil {
181183
return 0, 0, s.ErrorMapper(err)
182184
}
@@ -284,9 +286,7 @@ func (s SQL) Delete(ctx context.Context, query rel.Query) (int, error) {
284286

285287
// SchemaApply performs migration to database.
286288
func (s SQL) SchemaApply(ctx context.Context, migration rel.Migration) error {
287-
var (
288-
statement string
289-
)
289+
var statement string
290290

291291
switch v := migration.(type) {
292292
case rel.Table:

0 commit comments

Comments
 (0)