Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default adapter Name implementation #59

Merged
merged 3 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
14 changes: 7 additions & 7 deletions sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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:
Expand Down
Loading