func (e *ColumnDefaultValue) WithType(outType Type) (*ColumnDefaultValue, error) {
	if e == nil {
		return nil, nil
	}
	if err := e.checkType(outType); err != nil {
		return nil, err
	}
	return NewColumnDefaultValue(e.Expression, outType, e.literal, e.returnNil)
}
WithType returns a new default value that converts all resulting values from the internal expression into the given type.
If the internal expression results in a value that cannot be converted to the given type, then an error is returned.
package sql
import (
	"fmt"
)
type ColumnDefaultValue struct {
	Expression       
	outType    Type  
	literal    bool  
	returnNil  bool  
}
var _ Expression = (*ColumnDefaultValue)(nil)
func NewColumnDefaultValue(expr Expression, outType Type, representsLiteral bool, mayReturnNil bool) (*ColumnDefaultValue, error) {
	colDefault := &ColumnDefaultValue{
		Expression: expr,
		outType:    outType,
		literal:    representsLiteral,
		returnNil:  mayReturnNil,
	}
	if err := colDefault.checkType(outType); err != nil {
		return nil, err
	}
	return colDefault, nil
}
func (e *ColumnDefaultValue) Children() []Expression {
	if e == nil {
		return nil
	}
	return []Expression{e.Expression}
}
func (e *ColumnDefaultValue) Eval(ctx *Context, r Row) (interface{}, error) {
	if e == nil {
		return nil, nil
	}
	val, err := e.Expression.Eval(ctx, r)
	if err != nil {
		return nil, err
	}
	if e.outType != nil {
		val, err = e.outType.Convert(val)
		if err != nil {
			return nil, err
		}
	}
	if val == nil && !e.returnNil {
		return nil, ErrColumnDefaultReturnedNull.New()
	}
	return val, nil
}
func (e *ColumnDefaultValue) IsLiteral() bool {
	if e == nil {
		return true  
	}
	return e.literal
}
func (e *ColumnDefaultValue) IsNullable() bool {
	if e == nil {
		return true
	}
	if !e.returnNil {
		return false
	}
	return e.Expression.IsNullable()
}
func (e *ColumnDefaultValue) Resolved() bool {
	if e == nil {
		return true
	}
	if e.outType == nil {
		return false
	}
	return e.Expression.Resolved()
}
func (e *ColumnDefaultValue) String() string {
	if e == nil {
		return ""
	}
	if e.literal {
		return e.Expression.String()
	} else {
		return fmt.Sprintf("(%s)", e.Expression.String())
	}
}
func (e *ColumnDefaultValue) Type() Type {
	if e == nil {
		return Null
	}
	if e.outType == nil {
		return e.Expression.Type()
	}
	return e.outType
}
func (e *ColumnDefaultValue) WithChildren(children ...Expression) (Expression, error) {
	if e == nil && len(children) == 0 {
		return e, nil
	}
	if len(children) != 1 {
		return nil, ErrInvalidChildrenNumber.New(e, len(children), 1)
	}
	if e == nil {
		return NewColumnDefaultValue(children[0], e.outType, len(children[0].Children()) == 0, true)  
	} else {
		return NewColumnDefaultValue(children[0], e.outType, e.literal, e.returnNil)
	}
}