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

Method SQLString

coderd/rbac/regosql/sqltypes/equality.go:46–65  ·  view source on GitHub ↗
(cfg *SQLGenerator)

Source from the content-addressed store, hash-verified

44func (equality) UseAs() Node { return AstBoolean{} }
45
46func (e equality) SQLString(cfg *SQLGenerator) string {
47 // Equalities can be flipped without changing the result, so we can
48 // try both left = right and right = left.
49 if eq, ok := e.Left.(SupportsEquality); ok {
50 v, err := eq.EqualsSQLString(cfg, e.Not, e.Right)
51 if err == nil {
52 return v
53 }
54 }
55
56 if eq, ok := e.Right.(SupportsEquality); ok {
57 v, err := eq.EqualsSQLString(cfg, e.Not, e.Left)
58 if err == nil {
59 return v
60 }
61 }
62
63 cfg.AddError(xerrors.Errorf("unsupported equality: %T %s %T", e.Left, equalsOp(e.Not), e.Right))
64 return "EqualityError"
65}
66
67func (e equality) EqualsSQLString(cfg *SQLGenerator, not bool, other Node) (string, error) {
68 return boolEqualsSQLString(cfg, e, not, other)

Callers

nothing calls this directly

Calls 4

equalsOpFunction · 0.85
EqualsSQLStringMethod · 0.65
AddErrorMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected