MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / JSONArrayContains

Method JSONArrayContains

internal/store/dialect.go:243–247  ·  view source on GitHub ↗
(column, value string)

Source from the content-addressed store, hash-verified

241}
242
243func (d *sqliteDialect) JSONArrayContains(column, value string) (string, interface{}) {
244 // The CASE keeps json_type/json_each away from a malformed row, which
245 // would otherwise fail the whole query.
246 return "(CASE WHEN json_valid(" + column + ") THEN (json_type(" + column + ") = 'array' AND EXISTS (SELECT 1 FROM json_each(" + column + ") je_tag WHERE je_tag.type = 'text' AND je_tag.value = ?)) ELSE 0 END)", value
247}
248
249func (d *sqliteDialect) JSONArrayElements(column, alias string) (string, string) {
250 return "json_each(" + column + ") " + alias, alias + ".value"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected