| 241 | } |
| 242 | |
| 243 | func escapeUnicodeString(s string) string { |
| 244 | var result strings.Builder |
| 245 | for _, ch := range s { |
| 246 | switch ch { |
| 247 | case '\'': |
| 248 | result.WriteString("''") |
| 249 | case '\\': |
| 250 | result.WriteString(`\\`) |
| 251 | default: |
| 252 | if ch <= 127 { // ASCII |
| 253 | result.WriteRune(ch) |
| 254 | } else { |
| 255 | codepoint := int(ch) |
| 256 | if codepoint <= 0xFFFF { |
| 257 | result.WriteString(fmt.Sprintf("\\%04X", codepoint)) |
| 258 | } else { |
| 259 | result.WriteString(fmt.Sprintf("\\+%06X", codepoint)) |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | } |
| 264 | return result.String() |
| 265 | } |
| 266 | |
| 267 | // DateTimeField represents date/time fields that can be extracted or used in operations |
| 268 | type DateTimeField int |