You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, I also have an hstore on the table that makes this Where clause less elegant
whereMetaClauseMap := map[string]interface{}{
meta_data_1: "foo",
meta_data_2: "bar",
}
for k, v := range whereMetaClauseMap {
selectBuilder = selectBuilder.Where("meta @> '?=>?'", k, v)
}
For now, I have the following workaround:
selectBuilder := psql.
Select(SelectAbuseRows).
From(abuseTable).
Where(paramsWhereClauseMap)
for k, v := range whereMetaClauseMap {
selectBuilder = selectBuilder.Where("meta @> '?=>?'", k, v)
}
My Question
Is there a more elegant solution to passing in a kv map to where it outputs for an hstore lookup?
(similar to how a map will generate a basic where clause)
The text was updated successfully, but these errors were encountered:
I don't plan to add support for dialect-specific features like that into Squirrel itself, but the Sqlizer (ToSql) interface is public so you could create your own wrapper. There are many examples of various complexity in https://github.com/Masterminds/squirrel/blob/master/expr.go
Thanks for the quick reply,
I'll poke around and see what I can do with what you've given me and report back for others that may have run into the same issue.
Thank you
I have a GET endpoint that searches a resource by converting a struct into a map and passing it to Squirrel
And this typically works very well when passing the map literal into there where:
However, I also have an hstore on the table that makes this Where clause less elegant
For now, I have the following workaround:
My Question
Is there a more elegant solution to passing in a kv map to where it outputs for an hstore lookup?
(similar to how a map will generate a basic where clause)
The text was updated successfully, but these errors were encountered: