MCPcopy
hub / github.com/sqlc-dev/sqlc / getFuncByName

Method getFuncByName

internal/sql/catalog/schema.go:46–62  ·  view source on GitHub ↗
(rel *ast.FuncName)

Source from the content-addressed store, hash-verified

44}
45
46func (s *Schema) getFuncByName(rel *ast.FuncName) (*Function, int, error) {
47 idx := -1
48 name := strings.ToLower(rel.Name)
49 for i := range s.Funcs {
50 lowered := strings.ToLower(s.Funcs[i].Name)
51 if lowered == name && idx >= 0 {
52 return nil, -1, sqlerr.FunctionNotUnique(rel.Name)
53 }
54 if lowered == name {
55 idx = i
56 }
57 }
58 if idx < 0 {
59 return nil, -1, sqlerr.RelationNotFound(rel.Name)
60 }
61 return s.Funcs[idx], idx, nil
62}
63
64func (s *Schema) getTable(rel *ast.TableName) (*Table, int, error) {
65 for i := range s.Tables {

Callers 1

dropFunctionMethod · 0.80

Calls 2

FunctionNotUniqueFunction · 0.92
RelationNotFoundFunction · 0.92

Tested by

no test coverage detected