MySQL cast expressions.
This commit is contained in:
parent
fcce8d4262
commit
53dbcd9bfc
41 changed files with 1136 additions and 684 deletions
|
|
@ -73,6 +73,16 @@ func AssertDebugStatementSql(t *testing.T, query jet.Statement, expectedQuery st
|
|||
assert.Equal(t, debuqSql, expectedQuery)
|
||||
}
|
||||
|
||||
func Date(t string) *time.Time {
|
||||
newTime, err := time.Parse("2006-01-02", t)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return &newTime
|
||||
}
|
||||
|
||||
func TimestampWithoutTimeZone(t string, precision int) *time.Time {
|
||||
|
||||
precisionStr := ""
|
||||
|
|
@ -89,3 +99,40 @@ func TimestampWithoutTimeZone(t string, precision int) *time.Time {
|
|||
|
||||
return &newTime
|
||||
}
|
||||
|
||||
func TimeWithoutTimeZone(t string) *time.Time {
|
||||
newTime, err := time.Parse("15:04:05", t)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return &newTime
|
||||
}
|
||||
|
||||
func TimeWithTimeZone(t string) *time.Time {
|
||||
newTimez, err := time.Parse("15:04:05 -0700", t)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return &newTimez
|
||||
}
|
||||
|
||||
func TimestampWithTimeZone(t string, precision int) *time.Time {
|
||||
|
||||
precisionStr := ""
|
||||
|
||||
if precision > 0 {
|
||||
precisionStr = "." + strings.Repeat("9", precision)
|
||||
}
|
||||
|
||||
newTime, err := time.Parse("2006-01-02 15:04:05"+precisionStr+" -0700 MST", t)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return &newTime
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue