Example_dialectSupport demonstrates SQL dialect-specific keyword recognition.
()
| 48 | |
| 49 | // Example_dialectSupport demonstrates SQL dialect-specific keyword recognition. |
| 50 | func 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. |
| 82 | func Example_caseInsensitivity() { |