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

Function convertModelTokens

pkg/sql/parser/convert_helpers_test.go:33–42  ·  view source on GitHub ↗

convertModelTokens converts a []models.TokenWithSpan to []token.Token. This is a test helper used to verify that the backward-compatible Parse API produces the same AST as ParseFromModelTokens. Production code should use ParseFromModelTokens directly and never convert backwards. Deprecated: used o

(tokens []models.TokenWithSpan)

Source from the content-addressed store, hash-verified

31//
32// Deprecated: used only by backward-compat tests; prefer ParseFromModelTokens.
33func convertModelTokens(tokens []models.TokenWithSpan) ([]token.Token, error) {
34 result := make([]token.Token, len(tokens))
35 for i, t := range tokens {
36 result[i] = token.Token{
37 Type: t.Token.Type,
38 Literal: t.Token.Value,
39 }
40 }
41 return result, nil
42}

Calls

no outgoing calls

Tested by

no test coverage detected