From e957753ce4b863bd6dde0af22df3586f4f7a58a7 Mon Sep 17 00:00:00 2001 From: Hein Date: Mon, 7 Sep 2026 17:07:22 +0200 Subject: [PATCH] chore(common): satisfy linter on json_column.go (named results, De Morgan) --- pkg/common/json_column.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/common/json_column.go b/pkg/common/json_column.go index 2296278..db74326 100644 --- a/pkg/common/json_column.go +++ b/pkg/common/json_column.go @@ -173,7 +173,7 @@ func ParseColumnRef(raw string) (ColumnRef, bool) { // SQL renders the reference as a parameterised SQL expression plus its args. // tableAlias, when non-empty, qualifies the base column (each dot-separated // part is quoted independently, so "public.users" -> `"public"."users"`). -func (r ColumnRef) SQL(tableAlias string) (string, []interface{}) { +func (r ColumnRef) SQL(tableAlias string) (expr string, args []interface{}) { base := quoteQualifiedIdent(r.Base) if tableAlias != "" { base = quoteQualifiedIdent(tableAlias) + "." + QuoteIdent(r.Base) @@ -190,8 +190,8 @@ func (r ColumnRef) SQL(tableAlias string) (string, []interface{}) { if r.AsText { op = "#>>" } - expr := fmt.Sprintf("(%s %s ?::text[])", base, op) - args := []interface{}{pgTextArrayLiteral(r.Path)} + expr = fmt.Sprintf("(%s %s ?::text[])", base, op) + args = []interface{}{pgTextArrayLiteral(r.Path)} if r.Cast != "" { expr = fmt.Sprintf("(%s)::%s", expr, r.Cast) @@ -324,8 +324,9 @@ func validateRef(ref *ColumnRef) bool { // (letters/digits/spaces only) rather than, say, part of a JSON operator. func looksLikeCastTail(s string) bool { for _, r := range s { - if !(r == ' ' || r == '_' || - (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9')) { + isCastChar := r == ' ' || r == '_' || + (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') + if !isCastChar { return false } }