Skip to content

Commit 1119816

Browse files
authored
feat: add operator (#373)
1 parent 1598d9c commit 1119816

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

query/expression.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ func Match(key string, value any) keyValue {
130130
}
131131
}
132132

133+
func Like(key string, value any) keyValue {
134+
return keyValue{
135+
operator: "$like",
136+
key: key,
137+
value: value,
138+
}
139+
}
140+
133141
func Or(items ...Builder) set {
134142
return set{
135143
operator: "or",
@@ -270,7 +278,7 @@ func mapMapToExpression(m map[string]any) (Builder, error) {
270278
return nil, errors.Wrap(err, "parsing $and")
271279
}
272280
return and, nil
273-
case "$match", "$gte", "$lte", "$gt", "$lt", "$exists":
281+
case "$match", "$gte", "$lte", "$gt", "$lt", "$exists", "$like":
274282
match, err := parseKeyValue(operator, value)
275283
if err != nil {
276284
return nil, errors.Wrapf(err, "parsing %s", operator)

0 commit comments

Comments
 (0)