Skip to content

Commit e626185

Browse files
committed
implement Injectable
1 parent b02d6d5 commit e626185

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sql/expression/literal.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"strings"
2020

2121
"github.com/dolthub/vitess/go/vt/proto/query"
22+
"github.com/dolthub/vitess/go/vt/sqlparser"
2223
"github.com/shopspring/decimal"
2324

2425
"github.com/dolthub/go-mysql-server/sql"
@@ -35,6 +36,7 @@ type Literal struct {
3536
var _ sql.Expression = &Literal{}
3637
var _ sql.Expression2 = &Literal{}
3738
var _ sql.CollationCoercible = &Literal{}
39+
var _ sqlparser.Injectable = &Literal{}
3840

3941
// NewLiteral creates a new Literal expression.
4042
func NewLiteral(value interface{}, fieldType sql.Type) *Literal {
@@ -150,3 +152,10 @@ func (lit *Literal) Type2() sql.Type2 {
150152
func (p *Literal) Value() interface{} {
151153
return p.value
152154
}
155+
156+
func (lit *Literal) WithResolvedChildren(children []any) (any, error) {
157+
if len(children) != 0 {
158+
return nil, sql.ErrInvalidChildrenNumber.New(lit, len(children), 0)
159+
}
160+
return lit, nil
161+
}

0 commit comments

Comments
 (0)