MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / excludedColumnRef

Function excludedColumnRef

internal/sql/validate/insert_stmt.go:125–141  ·  view source on GitHub ↗

excludedColumnRef returns the column name if the ColumnRef is an EXCLUDED.col reference, and ok=true. Returns "", false otherwise.

(ref *ast.ColumnRef)

Source from the content-addressed store, hash-verified

123// excludedColumnRef returns the column name if the ColumnRef is an EXCLUDED.col
124// reference, and ok=true. Returns "", false otherwise.
125func excludedColumnRef(ref *ast.ColumnRef) (string, bool) {
126 if ref.Fields == nil || len(ref.Fields.Items) != 2 {
127 return "", false
128 }
129
130 first, ok := ref.Fields.Items[0].(*ast.String)
131 if !ok || !strings.EqualFold(first.Str, excludedTable) {
132 return "", false
133 }
134
135 second, ok := ref.Fields.Items[1].(*ast.String)
136 if !ok {
137 return "", false
138 }
139
140 return second.Str, true
141}

Callers 1

onConflictClauseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected