这是indexloc提供的服务,不要输入任何密码
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: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,5 @@ jobs:
echo "DB_HOST=127.0.0.1" >> $GITHUB_ENV
echo "UPPER_DB_LOG=ERROR" >> $GITHUB_ENV

- name: Get requisites
run: |
go get -v modernc.org/ql/ql

- name: Execute main task
run: make ${{ matrix.target }}
5 changes: 5 additions & 0 deletions adapter/mysql/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ func TestTemplateSelect(t *testing.T) {
"SELECT * FROM `artist` WHERE (`id` IN ($1, $2) AND `name` LIKE $3)",
b.SelectFrom("artist").Where(db.Cond{"name LIKE": "%foo", "id": db.In(1, 2)}).String(),
)

assert.Equal(
"SELECT * FROM `artist` WHERE (`id` IN ($1, $2) AND `name` LIKE $3)",
b.SelectFrom("artist").Where(db.Cond{"name LIKE": "%foo", "id": db.AnyOf([]int{1, 2})}).String(),
)
}
}

Expand Down
10 changes: 10 additions & 0 deletions comparison.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,21 @@ func In(value ...interface{}) *Comparison {
return &Comparison{adapter.NewComparisonOperator(adapter.ComparisonOperatorIn, toInterfaceArray(value))}
}

// AnyOf is a comparison that means: is any of the values of the slice.
func AnyOf(value interface{}) *Comparison {
return &Comparison{adapter.NewComparisonOperator(adapter.ComparisonOperatorIn, toInterfaceArray(value))}
}

// NotIn is a comparison that means: is none of the values.
func NotIn(value ...interface{}) *Comparison {
return &Comparison{adapter.NewComparisonOperator(adapter.ComparisonOperatorNotIn, toInterfaceArray(value))}
}

// NotAnyOf is a comparison that means: is none of the values of the slice.
func NotAnyOf(value interface{}) *Comparison {
return &Comparison{adapter.NewComparisonOperator(adapter.ComparisonOperatorNotIn, toInterfaceArray(value))}
}

// After is a comparison that means: is after the (time.Time) value.
func After(value time.Time) *Comparison {
return &Comparison{adapter.NewComparisonOperator(adapter.ComparisonOperatorGreaterThan, value)}
Expand Down