MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / validateQueryName

Function validateQueryName

internal/metadata/meta.go:45–59  ·  view source on GitHub ↗

A query name must be a valid Go identifier https://golang.org/ref/spec#Identifiers

(name string)

Source from the content-addressed store, hash-verified

43//
44// https://golang.org/ref/spec#Identifiers
45func validateQueryName(name string) error {
46 if len(name) == 0 {
47 return fmt.Errorf("invalid query name: %q", name)
48 }
49 for i, c := range name {
50 isLetter := unicode.IsLetter(c) || c == '_'
51 isDigit := unicode.IsDigit(c)
52 if i == 0 && !isLetter {
53 return fmt.Errorf("invalid query name %q", name)
54 } else if !(isLetter || isDigit) {
55 return fmt.Errorf("invalid query name %q", name)
56 }
57 }
58 return nil
59}
60
61func ParseQueryNameAndType(t string, commentStyle CommentSyntax) (string, string, error) {
62 for _, line := range strings.Split(t, "\n") {

Callers 1

ParseQueryNameAndTypeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected