(cfg ConvertConfig, terms []*ast.Term, expected int)
| 152 | } |
| 153 | |
| 154 | func convertTerms(cfg ConvertConfig, terms []*ast.Term, expected int) ([]sqltypes.Node, error) { |
| 155 | if len(terms) != expected { |
| 156 | return nil, xerrors.Errorf("expected %d terms, got %d", expected, len(terms)) |
| 157 | } |
| 158 | |
| 159 | result := make([]sqltypes.Node, 0, len(terms)) |
| 160 | for _, t := range terms { |
| 161 | term, err := convertTerm(cfg, t) |
| 162 | if err != nil { |
| 163 | return nil, xerrors.Errorf("term: %w", err) |
| 164 | } |
| 165 | result = append(result, term) |
| 166 | } |
| 167 | |
| 168 | return result, nil |
| 169 | } |
| 170 | |
| 171 | func convertTerm(cfg ConvertConfig, term *ast.Term) (sqltypes.Node, error) { |
| 172 | source := sqltypes.RegoSource(term.String()) |
no test coverage detected