MCPcopy Create free account
hub / github.com/PostHog/duckgres / extractStringConstant

Function extractStringConstant

transpiler/transform/functions.go:512–522  ·  view source on GitHub ↗

extractStringConstant extracts the string value from an AST node if it's a string constant.

(node *pg_query.Node)

Source from the content-addressed store, hash-verified

510
511// extractStringConstant extracts the string value from an AST node if it's a string constant.
512func extractStringConstant(node *pg_query.Node) string {
513 if node == nil {
514 return ""
515 }
516 if ac := node.GetAConst(); ac != nil {
517 if sval := ac.GetSval(); sval != nil {
518 return sval.Sval
519 }
520 }
521 return ""
522}
523
524// setStringConstant sets the string value of an AST node that is a string constant.
525func setStringConstant(node *pg_query.Node, value string) {

Callers 5

rewriteFormatMethod · 0.85
handleSubstringMethod · 0.85
handleToCharMethod · 0.85
handleToDateMethod · 0.85
handleToTimestampMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected