IsValidDialect reports whether name is a recognised SQL dialect identifier. An empty string is also considered valid (meaning "use the default dialect"). Example: keywords.IsValidDialect("mysql") // true keywords.IsValidDialect("fakesql") // false keywords.IsValidDialect("") /
(name string)
| 120 | // keywords.IsValidDialect("fakesql") // false |
| 121 | // keywords.IsValidDialect("") // true (default) |
| 122 | func IsValidDialect(name string) bool { |
| 123 | if name == "" { |
| 124 | return true |
| 125 | } |
| 126 | for _, d := range AllDialects() { |
| 127 | if string(d) == name { |
| 128 | return true |
| 129 | } |
| 130 | } |
| 131 | return false |
| 132 | } |
| 133 | |
| 134 | // AllDialects returns all supported SQL dialect identifiers. |
| 135 | // This includes both fully implemented dialects (with dialect-specific keywords) |