(t *testing.T)
| 231 | func intPtr(n int) *int { return &n } |
| 232 | |
| 233 | func TestFormatSQLValue(t *testing.T) { |
| 234 | tests := []struct { |
| 235 | name string |
| 236 | v any |
| 237 | want string |
| 238 | }{ |
| 239 | {"nil", nil, "NULL"}, |
| 240 | {"true", true, "TRUE"}, |
| 241 | {"false", false, "FALSE"}, |
| 242 | {"int", int64(42), "42"}, |
| 243 | {"negative int", int64(-1), "-1"}, |
| 244 | {"float", float64(3.14), "3.14"}, |
| 245 | {"string", "hello", "'hello'"}, |
| 246 | {"string with quote", "it's", "'it''s'"}, |
| 247 | {"string with double quote", `say "hi"`, `'say "hi"'`}, |
| 248 | {"empty string", "", "''"}, |
| 249 | {"bytes", []byte("data"), "'data'"}, |
| 250 | {"bytes with quote", []byte("it's"), "'it''s'"}, |
| 251 | {"time", time.Date(2026, 3, 23, 12, 0, 0, 0, time.UTC), "'2026-03-23T12:00:00Z'"}, |
| 252 | } |
| 253 | |
| 254 | for _, tt := range tests { |
| 255 | t.Run(tt.name, func(t *testing.T) { |
| 256 | got := formatSQLValue(tt.v) |
| 257 | if got != tt.want { |
| 258 | t.Errorf("formatSQLValue(%v) = %s, want %s", tt.v, got, tt.want) |
| 259 | } |
| 260 | }) |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | func TestQuoteIdent(t *testing.T) { |
| 265 | tests := []struct { |
nothing calls this directly
no test coverage detected