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

Function New

pkg/sql/tokenizer/tokenizer.go:294–302  ·  view source on GitHub ↗

New creates a new Tokenizer with default configuration and keyword support. The returned tokenizer is ready to use for tokenizing SQL statements. For production use, prefer GetTokenizer() which uses object pooling for better performance and reduced allocations. Returns an error only if keyword ini

()

Source from the content-addressed store, hash-verified

292// }
293// tokens, err := tkz.Tokenize([]byte("SELECT * FROM users"))
294func New() (*Tokenizer, error) {
295 kw := keywords.NewKeywords()
296 return &Tokenizer{
297 keywords: kw,
298 dialect: keywords.DialectPostgreSQL,
299 pos: NewPosition(1, 0),
300 lineStarts: []int{0},
301 }, nil
302}
303
304// NewWithDialect creates a new Tokenizer configured for the given SQL dialect.
305// Dialect-specific keywords are recognized based on the dialect parameter.

Calls 2

NewKeywordsFunction · 0.92
NewPositionFunction · 0.85