mirror of
https://github.com/dolthub/dolt.git
synced 2025-12-30 16:12:39 -06:00
Merge branch 'angela/date_functions' into angelamayxie-49b8a44f
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/dolthub/go-mysql-server/sql/types"
|
||||
querypb "github.com/dolthub/vitess/go/vt/proto/query"
|
||||
"github.com/shopspring/decimal"
|
||||
|
||||
@@ -577,10 +578,14 @@ func readDate(val []byte) (date time.Time) {
|
||||
|
||||
func writeDate(buf []byte, val time.Time) {
|
||||
expectSize(buf, dateSize)
|
||||
t := uint32(val.Year() << yearShift)
|
||||
t += uint32(val.Month() << monthShift)
|
||||
t += uint32(val.Day())
|
||||
writeUint32(buf, t)
|
||||
if val.Equal(types.ZeroTime) {
|
||||
writeUint32(buf, 0)
|
||||
} else {
|
||||
t := uint32(val.Year() << yearShift)
|
||||
t += uint32(val.Month() << monthShift)
|
||||
t += uint32(val.Day())
|
||||
writeUint32(buf, t)
|
||||
}
|
||||
}
|
||||
|
||||
func compareDate(l, r time.Time) int {
|
||||
|
||||
Reference in New Issue
Block a user