MCPcopy Create free account
hub / github.com/dolthub/doltgresql / WithResolvedChildren

Method WithResolvedChildren

server/expression/in_tuple.go:250–271  ·  view source on GitHub ↗

WithResolvedChildren implements the vitess.InjectableExpression interface.

(ctx context.Context, children []any)

Source from the content-addressed store, hash-verified

248
249// WithResolvedChildren implements the vitess.InjectableExpression interface.
250func (it *InTuple) WithResolvedChildren(ctx context.Context, children []any) (any, error) {
251 if len(children) != 2 {
252 return nil, errors.Errorf("invalid vitess child count, expected `2` but got `%d`", len(children))
253 }
254 sqlCtx := ctx.(*sql.Context)
255 left, ok := children[0].(sql.Expression)
256 if !ok {
257 return nil, errors.Errorf("expected vitess child to be an expression but has type `%T`", children[0])
258 }
259
260 switch right := children[1].(type) {
261 case expression.Tuple:
262 return it.WithChildren(sqlCtx, left, right)
263 case *RecordExpr:
264 // TODO: For now, if we see a RecordExpr come in, we convert it to a vitess Tuple representation, so that
265 // the existing in_tuple code can work with it. Alternatively, we could change in_tuple to always
266 // work directly with a Record expression.
267 return it.WithChildren(sqlCtx, left, expression.Tuple(right.exprs))
268 default:
269 return nil, errors.Errorf("expected child to be a RecordExpr or vitess Tuple but has type `%T`", children[1])
270 }
271}
272
273// Left implements the expression.BinaryExpression interface.
274func (it *InTuple) Left() sql.Expression {

Callers

nothing calls this directly

Calls 2

WithChildrenMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected