diff --git a/go.mod b/go.mod index 90fe27e3a..61233418c 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,6 @@ require ( github.com/gorilla/securecookie v1.1.1 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 - github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 github.com/jackc/pgconn v1.14.3 github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa github.com/jackc/pgx/v4 v4.18.2 @@ -40,7 +39,7 @@ require ( github.com/ory/dockertest/v3 v3.10.0 github.com/pkg/errors v0.9.1 github.com/pkg/profile v1.7.0 - github.com/raystack/salt v0.6.2 + github.com/raystack/salt v0.6.3 github.com/robfig/cron/v3 v3.0.1 github.com/rs/cors v1.11.1 github.com/spf13/cobra v1.8.1 @@ -103,6 +102,7 @@ require ( github.com/google/go-tpm v0.9.0 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/leodido/go-urn v1.4.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect diff --git a/go.sum b/go.sum index deaf9bb64..caa471e40 100644 --- a/go.sum +++ b/go.sum @@ -1922,8 +1922,8 @@ github.com/prometheus/statsd_exporter v0.22.7 h1:7Pji/i2GuhK6Lu7DHrtTkFmNBCudCPT github.com/prometheus/statsd_exporter v0.22.7/go.mod h1:N/TevpjkIh9ccs6nuzY3jQn9dFqnUakOjnEuMPJJJnI= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/embedmd v0.0.0-20171029212350-c8060a0752a2/go.mod h1:7jOTMgqac46PZcF54q6l2hkLEG8op93fZu61KmxWDV4= -github.com/raystack/salt v0.6.2 h1:GPUQ6j3h3cFd3k42Lds1xbG672yvhUjO9ut9oAJqW9M= -github.com/raystack/salt v0.6.2/go.mod h1:Dwc5VlPevdY56XgYjWd+Ubkil7ohCM4526dkAuWnGN4= +github.com/raystack/salt v0.6.3 h1:ZfSumyhvRIx9nf2g9aQKDRdSJQuQ+e6+TC2FnOfpv60= +github.com/raystack/salt v0.6.3/go.mod h1:3f9NBwwtuniW5xOsyQ3ntcugFVTFDDZBqHw6rX6+8w4= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= diff --git a/internal/store/postgres/org_billing_repository.go b/internal/store/postgres/org_billing_repository.go index 8dd5f9527..eb9ab79bf 100644 --- a/internal/store/postgres/org_billing_repository.go +++ b/internal/store/postgres/org_billing_repository.go @@ -22,6 +22,8 @@ const ( OPERATOR_NOT_IN = "notin" OPERATOR_LIKE = "like" OPERATOR_NOT_LIKE = "notlike" + OPERATOR_ILIKE = "ilike" + OPERATOR_NOT_ILIKE = "notilike" ) const ( @@ -415,6 +417,10 @@ func processStringDataType(filter rql.Filter, query *goqu.SelectDataset) *goqu.S case OPERATOR_NOT_LIKE: // some semi string sql types like UUID require casting to text to support like operator query = query.Where(goqu.L(fmt.Sprintf(`"%s"::TEXT NOT LIKE '%s'`, filter.Name, filter.Value.(string)))) + case OPERATOR_ILIKE: + query = query.Where(goqu.L(fmt.Sprintf(`"%s"::TEXT ILIKE '%s'`, filter.Name, filter.Value.(string)))) + case OPERATOR_NOT_ILIKE: + query = query.Where(goqu.L(fmt.Sprintf(`"%s"::TEXT NOT ILIKE '%s'`, filter.Name, filter.Value.(string)))) default: query = query.Where(goqu.Ex{filter.Name: goqu.Op{filter.Operator: filter.Value.(string)}}) } diff --git a/web/sdk/admin/utils/transform-query.ts b/web/sdk/admin/utils/transform-query.ts index 1faed02b1..9d46e3a21 100644 --- a/web/sdk/admin/utils/transform-query.ts +++ b/web/sdk/admin/utils/transform-query.ts @@ -57,18 +57,11 @@ function transformFilter( value = convertFilterValue(filter.value); } - // TODO: add support for ilike in RQL and backend - // Transform ilike operator to like only for string values - const operator = - filter.operator === "ilike" && value.case === "stringValue" - ? "like" - : filter.operator; - const fieldName = fieldNameMapping?.[filter.name] ?? filter.name; return create(RQLFilterSchema, { name: fieldName, - operator, + operator: filter.operator, value, }); }