(rel *ast.FuncName, tns []*ast.TypeName)
| 19 | } |
| 20 | |
| 21 | func (s *Schema) getFunc(rel *ast.FuncName, tns []*ast.TypeName) (*Function, int, error) { |
| 22 | for i := range s.Funcs { |
| 23 | if !strings.EqualFold(s.Funcs[i].Name, rel.Name) { |
| 24 | continue |
| 25 | } |
| 26 | |
| 27 | args := s.Funcs[i].InArgs() |
| 28 | if len(args) != len(tns) { |
| 29 | continue |
| 30 | } |
| 31 | found := true |
| 32 | for j := range args { |
| 33 | if !sameType(s.Funcs[i].Args[j].Type, tns[j]) { |
| 34 | found = false |
| 35 | break |
| 36 | } |
| 37 | } |
| 38 | if !found { |
| 39 | continue |
| 40 | } |
| 41 | return s.Funcs[i], i, nil |
| 42 | } |
| 43 | return nil, -1, sqlerr.RelationNotFound(rel.Name) |
| 44 | } |
| 45 | |
| 46 | func (s *Schema) getFuncByName(rel *ast.FuncName) (*Function, int, error) { |
| 47 | idx := -1 |
no test coverage detected