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

Function Example_dialectSupport

pkg/sql/keywords/example_test.go:50–79  ·  view source on GitHub ↗

Example_dialectSupport demonstrates SQL dialect-specific keyword recognition.

()

Source from the content-addressed store, hash-verified

48
49// Example_dialectSupport demonstrates SQL dialect-specific keyword recognition.
50func Example_dialectSupport() {
51 // Create keywords instance for PostgreSQL
52 pgKw := keywords.New(keywords.DialectPostgreSQL, true)
53
54 // PostgreSQL-specific keywords
55 if pgKw.IsKeyword("ILIKE") {
56 fmt.Println("ILIKE is a PostgreSQL keyword")
57 }
58
59 // Create keywords instance for MySQL
60 mysqlKw := keywords.New(keywords.DialectMySQL, true)
61
62 // MySQL-specific keywords
63 if mysqlKw.IsKeyword("ZEROFILL") {
64 fmt.Println("ZEROFILL is a MySQL keyword")
65 }
66
67 // Create keywords instance for SQLite
68 sqliteKw := keywords.New(keywords.DialectSQLite, true)
69
70 // SQLite-specific keywords
71 if sqliteKw.IsKeyword("AUTOINCREMENT") {
72 fmt.Println("AUTOINCREMENT is a SQLite keyword")
73 }
74
75 // Output:
76 // ILIKE is a PostgreSQL keyword
77 // ZEROFILL is a MySQL keyword
78 // AUTOINCREMENT is a SQLite keyword
79}
80
81// Example_caseInsensitivity demonstrates case-insensitive keyword matching.
82func Example_caseInsensitivity() {

Callers

nothing calls this directly

Calls 2

NewFunction · 0.92
IsKeywordMethod · 0.45

Tested by

no test coverage detected