MySQL linter errors.
This commit is contained in:
parent
5e76355275
commit
46a3dc7dfb
31 changed files with 254 additions and 136 deletions
|
|
@ -9,7 +9,7 @@ type cast interface {
|
|||
// Cast expressions as castType type
|
||||
AS(castType string) Expression
|
||||
// Cast expression as char with optional length
|
||||
AS_CHAR(lenght ...int) StringExpression
|
||||
AS_CHAR(length ...int) StringExpression
|
||||
// Cast expression AS date type
|
||||
AS_DATE() DateExpression
|
||||
// Cast expression AS numeric type, using precision and optionally scale
|
||||
|
|
@ -30,6 +30,7 @@ type castImpl struct {
|
|||
jet.Cast
|
||||
}
|
||||
|
||||
// CAST function converts a expr (of any type) into latter specified datatype.
|
||||
func CAST(expr Expression) cast {
|
||||
castImpl := &castImpl{}
|
||||
|
||||
|
|
@ -38,45 +39,51 @@ func CAST(expr Expression) cast {
|
|||
return castImpl
|
||||
}
|
||||
|
||||
// AS casts expressions to castType
|
||||
func (c *castImpl) AS(castType string) Expression {
|
||||
return c.Cast.AS(castType)
|
||||
}
|
||||
|
||||
// AS_DATETIME cast expression to DATETIME type
|
||||
func (c *castImpl) AS_DATETIME() DateTimeExpression {
|
||||
return DateTimeExp(c.AS("DATETIME"))
|
||||
}
|
||||
|
||||
// AS_SIGNED casts expression to SIGNED type
|
||||
func (c *castImpl) AS_SIGNED() IntegerExpression {
|
||||
return IntExp(c.AS("SIGNED"))
|
||||
}
|
||||
|
||||
// AS_UNSIGNED casts expression to UNSIGNED type
|
||||
func (c *castImpl) AS_UNSIGNED() IntegerExpression {
|
||||
return IntExp(c.AS("UNSIGNED"))
|
||||
}
|
||||
|
||||
func (b *castImpl) AS_CHAR(lenght ...int) StringExpression {
|
||||
if len(lenght) > 0 {
|
||||
return StringExp(b.AS("CHAR(" + strconv.Itoa(lenght[0]) + ")"))
|
||||
// AS_CHAR casts expression to CHAR type with optional length
|
||||
func (c *castImpl) AS_CHAR(length ...int) StringExpression {
|
||||
if len(length) > 0 {
|
||||
return StringExp(c.AS("CHAR(" + strconv.Itoa(length[0]) + ")"))
|
||||
}
|
||||
|
||||
return StringExp(b.AS("CHAR"))
|
||||
return StringExp(c.AS("CHAR"))
|
||||
}
|
||||
|
||||
// Cast expression AS date type
|
||||
func (b *castImpl) AS_DATE() DateExpression {
|
||||
return DateExp(b.AS("DATE"))
|
||||
// AS_DATE casts expression AS DATE type
|
||||
func (c *castImpl) AS_DATE() DateExpression {
|
||||
return DateExp(c.AS("DATE"))
|
||||
}
|
||||
|
||||
// Cast expression AS date type
|
||||
func (b *castImpl) AS_DECIMAL() FloatExpression {
|
||||
return FloatExp(b.AS("DECIMAL"))
|
||||
// AS_DECIMAL casts expression AS DECIMAL type
|
||||
func (c *castImpl) AS_DECIMAL() FloatExpression {
|
||||
return FloatExp(c.AS("DECIMAL"))
|
||||
}
|
||||
|
||||
// Cast expression AS date type
|
||||
func (b *castImpl) AS_TIME() TimeExpression {
|
||||
return TimeExp(b.AS("TIME"))
|
||||
// AS_TIME casts expression AS TIME type
|
||||
func (c *castImpl) AS_TIME() TimeExpression {
|
||||
return TimeExp(c.AS("TIME"))
|
||||
}
|
||||
|
||||
// AS_BINARY casts expression as BINARY type
|
||||
func (c *castImpl) AS_BINARY() StringExpression {
|
||||
return StringExp(c.AS("BINARY"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue