func (d *DateAdd) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	date, err := d.Date.Eval(ctx, row)
	if err != nil {
		return nil, err
	}
	if date == nil {
		return nil, nil
	}
	date, err = sql.Datetime.Convert(date)
	if err != nil {
		return nil, err
	}
	delta, err := d.Interval.EvalDelta(ctx, row)
	if err != nil {
		return nil, err
	}
	if delta == nil {
		return nil, nil
	}
	return sql.ValidateTime(delta.Add(date.(time.Time))), nil
}
Eval implements the sql.Expression interface.
package function
import (
	"fmt"
	"time"
	"github.com/dolthub/go-mysql-server/sql"
	"github.com/dolthub/go-mysql-server/sql/expression"
)
type DateAdd struct {
	Date     sql.Expression
	Interval *expression.Interval
}
var _ sql.FunctionExpression = (*DateAdd)(nil)
func NewDateAdd(args ...sql.Expression) (sql.Expression, error) {
	if len(args) != 2 {
		return nil, sql.ErrInvalidArgumentNumber.New("DATE_ADD", 2, len(args))
	}
	i, ok := args[1].(*expression.Interval)
	if !ok {
		return nil, fmt.Errorf("DATE_ADD expects an interval as second parameter")
	}
	return &DateAdd{args[0], i}, nil
}
func (d *DateAdd) FunctionName() string {
	return "date_add"
}
func (d *DateAdd) Children() []sql.Expression {
	return []sql.Expression{d.Date, d.Interval}
}
func (d *DateAdd) Resolved() bool {
	return d.Date.Resolved() && d.Interval.Resolved()
}
func (d *DateAdd) IsNullable() bool {
	return true
}
func (d *DateAdd) Type() sql.Type { return sql.Date }
func (d *DateAdd) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	return NewDateAdd(children...)
}