Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.18
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
id: go

- name: Check out code into the Go module directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.18
- name: Set up Go 1.19
uses: actions/setup-go@v3
with:
go-version: 1.18
go-version: 1.19
id: go

- name: Check out code into the Go module directory
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func main() {
WithFilter("id.null", false). // WHERE id.null IS NOT NULL
WithLimit(10). // LIMIT 10
WithOffset(0). // OFFSET 0
WithOrderBy("name asc") // ORDER BY name asc
WithOrderBy("name asc"). // ORDER BY name asc
WithForUpdate("SKIP LOCKED") // FOR UPDATE SKIP LOCKED
}
```
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module github.com/allisson/sqlutil

go 1.18
go 1.19

require (
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/allisson/sqlquery v1.0.1
github.com/georgysavva/scany v1.2.0
github.com/stretchr/testify v1.8.0
github.com/allisson/sqlquery v1.1.0
github.com/georgysavva/scany/v2 v2.0.0
github.com/stretchr/testify v1.8.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/huandu/go-sqlbuilder v1.15.1 // indirect
github.com/huandu/go-sqlbuilder v1.16.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
193 changes: 15 additions & 178 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"database/sql"

"github.com/allisson/sqlquery"
"github.com/georgysavva/scany/sqlscan"
"github.com/georgysavva/scany/v2/sqlscan"
)

type Flavor = sqlquery.Flavor
Expand Down
4 changes: 2 additions & 2 deletions helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func TestSelect(t *testing.T) {
defer db.Close()

rows := sqlmock.NewRows([]string{"id", "name"}).AddRow(1, "Ronaldinho Gaúcho").AddRow(2, "Ronaldo Fenômeno")
mock.ExpectQuery(regexp.QuoteMeta(`SELECT * FROM players LIMIT 10 OFFSET 0`)).WillReturnRows(rows)
mock.ExpectQuery(regexp.QuoteMeta(`SELECT * FROM players LIMIT 10 OFFSET 0 FOR UPDATE SKIP LOCKED`)).WillReturnRows(rows)

options := NewFindAllOptions(PostgreSQLFlavor).WithLimit(10).WithOffset(0)
options := NewFindAllOptions(PostgreSQLFlavor).WithLimit(10).WithOffset(0).WithForUpdate("SKIP LOCKED")
p := []*player{}
err = Select(context.Background(), db, "players", options, &p)
assert.Nil(t, err)
Expand Down
2 changes: 1 addition & 1 deletion script/lint
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

GIT_ROOT="$(git rev-parse --show-toplevel)"
LINT_VERSION="v1.49.0"
LINT_VERSION="v1.50.1"
LINT_BIN="$GIT_ROOT/.golangci-lint"

set -e
Expand Down