MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestFormatSQLWithDialect_PostgreSQL

Function TestFormatSQLWithDialect_PostgreSQL

pkg/transform/dialect_test.go:14–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestFormatSQLWithDialect_PostgreSQL(t *testing.T) {
15 tree, err := ParseSQL("SELECT * FROM users u")
16 if err != nil {
17 t.Fatalf("parse: %v", err)
18 }
19 stmt := tree.Statements[0]
20 if err := Apply(stmt, SetLimit(100)); err != nil {
21 t.Fatalf("apply: %v", err)
22 }
23
24 got := FormatSQLWithDialect(stmt, keywords.DialectPostgreSQL)
25 if !strings.Contains(got, "LIMIT 100") {
26 t.Errorf("postgresql: expected LIMIT 100, got: %s", got)
27 }
28}
29
30func TestFormatSQLWithDialect_SQLServer(t *testing.T) {
31 tree, err := ParseSQL("SELECT * FROM users u")

Callers

nothing calls this directly

Calls 6

ParseSQLFunction · 0.85
ApplyFunction · 0.85
SetLimitFunction · 0.85
FormatSQLWithDialectFunction · 0.85
FatalfMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected