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

Function Example_caseInsensitivity

pkg/sql/keywords/example_test.go:82–100  ·  view source on GitHub ↗

Example_caseInsensitivity demonstrates case-insensitive keyword matching.

()

Source from the content-addressed store, hash-verified

80
81// Example_caseInsensitivity demonstrates case-insensitive keyword matching.
82func Example_caseInsensitivity() {
83 // Create keywords with case-insensitive matching (default)
84 kw := keywords.New(keywords.DialectGeneric, true)
85
86 // All of these should match
87 examples := []string{"SELECT", "select", "Select", "SeLeCt"}
88
89 for _, word := range examples {
90 if kw.IsKeyword(word) {
91 fmt.Printf("%s is recognized as SELECT keyword\n", word)
92 }
93 }
94
95 // Output:
96 // SELECT is recognized as SELECT keyword
97 // select is recognized as SELECT keyword
98 // Select is recognized as SELECT keyword
99 // SeLeCt is recognized as SELECT keyword
100}
101
102// Example_tokenTypeMapping demonstrates mapping keywords to token types.
103func Example_tokenTypeMapping() {

Callers

nothing calls this directly

Calls 2

NewFunction · 0.92
IsKeywordMethod · 0.45

Tested by

no test coverage detected