Add DECIMAL constructor for Float literal.
DECIMAL constructor is used to pass a decimal number to the SQL query without precision loss.
This commit is contained in:
parent
08cc316101
commit
92d02fef78
3 changed files with 18 additions and 2 deletions
|
|
@ -140,7 +140,7 @@ type floatLiteral struct {
|
||||||
literalExpressionImpl
|
literalExpressionImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
// Float creates new float literal
|
// Float creates new float literal from float64 value
|
||||||
func Float(value float64) FloatExpression {
|
func Float(value float64) FloatExpression {
|
||||||
floatLiteral := floatLiteral{}
|
floatLiteral := floatLiteral{}
|
||||||
floatLiteral.literalExpressionImpl = *literal(value)
|
floatLiteral.literalExpressionImpl = *literal(value)
|
||||||
|
|
@ -150,6 +150,16 @@ func Float(value float64) FloatExpression {
|
||||||
return &floatLiteral
|
return &floatLiteral
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Decimal creates new float literal from string value
|
||||||
|
func Decimal(value string) FloatExpression {
|
||||||
|
floatLiteral := floatLiteral{}
|
||||||
|
floatLiteral.literalExpressionImpl = *literal(value)
|
||||||
|
|
||||||
|
floatLiteral.floatInterfaceImpl.parent = &floatLiteral
|
||||||
|
|
||||||
|
return &floatLiteral
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------//
|
//---------------------------------------------------//
|
||||||
type stringLiteral struct {
|
type stringLiteral struct {
|
||||||
stringInterfaceImpl
|
stringInterfaceImpl
|
||||||
|
|
|
||||||
|
|
@ -42,9 +42,12 @@ var Uint32 = jet.Uint32
|
||||||
// Uint64 is constructor for 64 bit unsigned integer expressions literals.
|
// Uint64 is constructor for 64 bit unsigned integer expressions literals.
|
||||||
var Uint64 = jet.Uint64
|
var Uint64 = jet.Uint64
|
||||||
|
|
||||||
// Float creates new float literal expression
|
// Float creates new float literal expression from float64 value
|
||||||
var Float = jet.Float
|
var Float = jet.Float
|
||||||
|
|
||||||
|
// Decimal creates new float literal expression from string value
|
||||||
|
var Decimal = jet.Decimal
|
||||||
|
|
||||||
// String creates new string literal expression
|
// String creates new string literal expression
|
||||||
var String = jet.String
|
var String = jet.String
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,9 @@ var Uint64 = jet.Uint64
|
||||||
// Float creates new float literal expression
|
// Float creates new float literal expression
|
||||||
var Float = jet.Float
|
var Float = jet.Float
|
||||||
|
|
||||||
|
// Decimal creates new float literal expression
|
||||||
|
var Decimal = jet.Decimal
|
||||||
|
|
||||||
// String creates new string literal expression
|
// String creates new string literal expression
|
||||||
var String = jet.String
|
var String = jet.String
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue