Example_dialectComparison demonstrates differences between SQL dialects.
()
| 165 | |
| 166 | // Example_dialectComparison demonstrates differences between SQL dialects. |
| 167 | func Example_dialectComparison() { |
| 168 | // Generic SQL |
| 169 | generic := keywords.New(keywords.DialectGeneric, true) |
| 170 | |
| 171 | // PostgreSQL |
| 172 | postgres := keywords.New(keywords.DialectPostgreSQL, true) |
| 173 | |
| 174 | // MySQL |
| 175 | mysql := keywords.New(keywords.DialectMySQL, true) |
| 176 | |
| 177 | // Check dialect-specific keywords |
| 178 | testWords := []string{"ILIKE", "ZEROFILL", "MATERIALIZED"} |
| 179 | |
| 180 | for _, word := range testWords { |
| 181 | genericMatch := generic.IsKeyword(word) |
| 182 | postgresMatch := postgres.IsKeyword(word) |
| 183 | mysqlMatch := mysql.IsKeyword(word) |
| 184 | |
| 185 | fmt.Printf("%s: Generic=%v, PostgreSQL=%v, MySQL=%v\n", |
| 186 | word, genericMatch, postgresMatch, mysqlMatch) |
| 187 | } |
| 188 | |
| 189 | // Output: |
| 190 | // ILIKE: Generic=false, PostgreSQL=true, MySQL=false |
| 191 | // ZEROFILL: Generic=false, PostgreSQL=false, MySQL=true |
| 192 | // MATERIALIZED: Generic=false, PostgreSQL=true, MySQL=false |
| 193 | } |