diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4794503..44c4f59 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,16 +14,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go: ["1.21"] + go: ["1.21", "1.22"] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} - name: Run tests run: | go test -v -race -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... ./... - - if: ${{ matrix.go == '1.21' }} + - if: ${{ matrix.go == '1.22' }} uses: shogo82148/actions-goveralls@v1 with: path-to-profile: coverage.txt @@ -32,13 +32,13 @@ jobs: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.21" + go-version: "1.22" cache: false - name: Run lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: - version: v1.55 + version: v1.56 args: --timeout 5m diff --git a/operator.go b/operator.go index de361ac..d456435 100644 --- a/operator.go +++ b/operator.go @@ -78,7 +78,7 @@ var ( "$in": {Function: multiComparison("IN"), RequiredArguments: 1}, "$notin": {Function: multiComparison("NOT IN"), RequiredArguments: 1}, "$isnull": { - Function: func(tx *gorm.DB, filter *Filter, column string, dataType DataType) *gorm.DB { + Function: func(tx *gorm.DB, filter *Filter, column string, _ DataType) *gorm.DB { return filter.Where(tx, column+" IS NULL") }, RequiredArguments: 0, @@ -102,7 +102,7 @@ var ( RequiredArguments: 0, }, "$notnull": { - Function: func(tx *gorm.DB, filter *Filter, column string, dataType DataType) *gorm.DB { + Function: func(tx *gorm.DB, filter *Filter, column string, _ DataType) *gorm.DB { return filter.Where(tx, column+" IS NOT NULL") }, RequiredArguments: 0, diff --git a/search_test.go b/search_test.go index f046928..9b9adad 100644 --- a/search_test.go +++ b/search_test.go @@ -16,7 +16,7 @@ func TestSearchScope(t *testing.T) { Fields: []string{"name", "email"}, Query: "My Query", Operator: &Operator{ - Function: func(tx *gorm.DB, filter *Filter, column string, dataType DataType) *gorm.DB { + Function: func(tx *gorm.DB, filter *Filter, column string, _ DataType) *gorm.DB { return tx.Or(fmt.Sprintf("%s LIKE (?)", column), filter.Args[0]) }, RequiredArguments: 1, @@ -92,7 +92,7 @@ func TestSearchScopeEmptyField(t *testing.T) { Fields: []string{}, Query: "My Query", Operator: &Operator{ - Function: func(tx *gorm.DB, filter *Filter, column string, dataType DataType) *gorm.DB { + Function: func(tx *gorm.DB, filter *Filter, column string, _ DataType) *gorm.DB { return tx.Or(fmt.Sprintf("%s LIKE (?)", column), filter.Args[0]) }, RequiredArguments: 1, @@ -135,7 +135,7 @@ func TestSeachScopeWithJoin(t *testing.T) { Fields: []string{"name", "Relation.name"}, Query: "My Query", Operator: &Operator{ - Function: func(tx *gorm.DB, filter *Filter, column string, dataType DataType) *gorm.DB { + Function: func(tx *gorm.DB, filter *Filter, column string, _ DataType) *gorm.DB { return tx.Or(fmt.Sprintf("%s LIKE (?)", column), filter.Args[0]) }, RequiredArguments: 1, @@ -244,7 +244,7 @@ func TestSeachScopeWithJoinNestedRelation(t *testing.T) { Fields: []string{"name", "Relation.NestedRelation.field"}, Query: "My Query", Operator: &Operator{ - Function: func(tx *gorm.DB, filter *Filter, column string, dataType DataType) *gorm.DB { + Function: func(tx *gorm.DB, filter *Filter, column string, _ DataType) *gorm.DB { return tx.Or(fmt.Sprintf("%s LIKE (?)", column), filter.Args[0]) }, RequiredArguments: 1, @@ -457,7 +457,7 @@ func TestSearchScopeWithUnsupportedDataType(t *testing.T) { Fields: []string{"name", "email"}, Query: "My Query", Operator: &Operator{ - Function: func(tx *gorm.DB, filter *Filter, column string, dataType DataType) *gorm.DB { + Function: func(tx *gorm.DB, filter *Filter, column string, _ DataType) *gorm.DB { return tx.Or(fmt.Sprintf("%s LIKE (?)", column), filter.Args[0]) }, RequiredArguments: 1, diff --git a/settings_test.go b/settings_test.go index b37cb48..87a3c85 100644 --- a/settings_test.go +++ b/settings_test.go @@ -102,7 +102,7 @@ func TestScope(t *testing.T) { paginator, err := prepareTestScope(t, &Settings[*TestScopeModel]{ FieldsSearch: []string{"email"}, SearchOperator: &Operator{ - Function: func(tx *gorm.DB, filter *Filter, column string, dataType DataType) *gorm.DB { + Function: func(tx *gorm.DB, filter *Filter, column string, _ DataType) *gorm.DB { return tx.Or(fmt.Sprintf("%s LIKE (?)", column), filter.Args[0]) }, RequiredArguments: 1, @@ -196,7 +196,7 @@ func TestScopeUnpaginated(t *testing.T) { results, db := prepareTestScopeUnpaginated(t, &Settings[*TestScopeModel]{ FieldsSearch: []string{"email"}, SearchOperator: &Operator{ - Function: func(tx *gorm.DB, filter *Filter, column string, dataType DataType) *gorm.DB { + Function: func(tx *gorm.DB, filter *Filter, column string, _ DataType) *gorm.DB { return tx.Or(fmt.Sprintf("%s LIKE (?)", column), filter.Args[0]) }, RequiredArguments: 1,