SQL returns the SQL literal representation of this value. Strings are single-quoted with proper escaping; NULLs are returned as "NULL"; booleans are returned in uppercase (TRUE/FALSE); numbers are returned as-is.
()
| 127 | // Strings are single-quoted with proper escaping; NULLs are returned as "NULL"; |
| 128 | // booleans are returned in uppercase (TRUE/FALSE); numbers are returned as-is. |
| 129 | func (l *LiteralValue) SQL() string { |
| 130 | if l == nil { |
| 131 | return "" |
| 132 | } |
| 133 | if l.Value == nil || strings.EqualFold(l.Type, "NULL") { |
| 134 | return "NULL" |
| 135 | } |
| 136 | switch strings.ToUpper(l.Type) { |
| 137 | case "STRING": |
| 138 | return "'" + escapeStringLiteral(fmt.Sprintf("%v", l.Value)) + "'" |
| 139 | case "BOOLEAN": |
| 140 | return strings.ToUpper(fmt.Sprintf("%v", l.Value)) |
| 141 | default: |
| 142 | return fmt.Sprintf("%v", l.Value) |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | // SQL returns the unquoted identifier name. Used for round-trip serialization. |
| 147 | func (i *Ident) SQL() string { |
nothing calls this directly
no test coverage detected