[feat] add filter registry
Signed-off-by: Anton Nesterov <anton@demiurg.io>
This commit is contained in:
parent
296595cfea
commit
ffb64f1d65
|
@ -22,6 +22,12 @@ var FilterRegistry = map[string]IFilter{
|
|||
"NotLike": &NotLike{},
|
||||
}
|
||||
|
||||
// RegisterFilter registers a new filter for a given name.
|
||||
// `name` is the name of the filter, and `filter` is an empty instance (&reference) of the IFilter.
|
||||
func RegisterFilter(name string, filter IFilter) {
|
||||
FilterRegistry[name] = filter
|
||||
}
|
||||
|
||||
func Convert(ctx Dialect, data interface{}) (string, []interface{}) {
|
||||
for _, impl := range FilterRegistry {
|
||||
filter := impl.FromJSON(data)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
adapter "l12.xyz/dal/adapter"
|
||||
)
|
||||
|
||||
type SQLiteContext = adapter.SQLite
|
||||
type SQLiteContext = adapter.CommonDialect
|
||||
|
||||
func TestEq(t *testing.T) {
|
||||
ctx := SQLiteContext{
|
||||
|
|
Loading…
Reference in a new issue