diff --git a/go.mod b/go.mod index b31d60c..c5874bd 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 toolchain go1.21.0 require ( - github.com/go-rel/rel v0.40.0 + github.com/go-rel/rel v0.40.1-0.20231007112841-2e07fc196025 github.com/stretchr/testify v1.8.4 ) diff --git a/go.sum b/go.sum index 144c955..2255d03 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/go-rel/rel v0.40.0 h1:Av2/Ub6fQn6UbwxTIHStfLb7W+knRhOVX8AWcC+pOBA= -github.com/go-rel/rel v0.40.0/go.mod h1:6opWRxsoHoDq67fIDnsmcmnojpskWpPqCs0AoL/UrEU= +github.com/go-rel/rel v0.40.1-0.20231007112841-2e07fc196025 h1:Gq1za5TzJT5h7ByoaSYsKpcMJ5QcRvW7aJwBUJZNLcc= +github.com/go-rel/rel v0.40.1-0.20231007112841-2e07fc196025/go.mod h1:6opWRxsoHoDq67fIDnsmcmnojpskWpPqCs0AoL/UrEU= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= diff --git a/sql.go b/sql.go index 733b7cc..4509f2a 100644 --- a/sql.go +++ b/sql.go @@ -33,6 +33,11 @@ type SQL struct { Instrumenter rel.Instrumenter } +// Name returns database adapter name. +func (s SQL) Name() string { + return "sql" +} + // Instrumentation set instrumenter for this adapter. func (s *SQL) Instrumentation(instrumenter rel.Instrumenter) { s.Instrumenter = instrumenter @@ -173,10 +178,7 @@ func (s SQL) Query(ctx context.Context, query rel.Query) (rel.Cursor, error) { // Exec performs exec operation. func (s SQL) Exec(ctx context.Context, statement string, args []any) (int64, int64, error) { - var ( - res, err = s.DoExec(ctx, statement, args) - ) - + res, err := s.DoExec(ctx, statement, args) if err != nil { return 0, 0, s.ErrorMapper(err) } @@ -284,9 +286,7 @@ func (s SQL) Delete(ctx context.Context, query rel.Query) (int, error) { // SchemaApply performs migration to database. func (s SQL) SchemaApply(ctx context.Context, migration rel.Migration) error { - var ( - statement string - ) + var statement string switch v := migration.(type) { case rel.Table: