MCPcopy Index your code
hub / github.com/coder/coder / convertTerms

Function convertTerms

coderd/rbac/regosql/compile.go:154–169  ·  view source on GitHub ↗
(cfg ConvertConfig, terms []*ast.Term, expected int)

Source from the content-addressed store, hash-verified

152}
153
154func 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
171func convertTerm(cfg ConvertConfig, term *ast.Term) (sqltypes.Node, error) {
172 source := sqltypes.RegoSource(term.String())

Callers 1

convertCallFunction · 0.85

Calls 2

convertTermFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected