You've already forked go-clickhouse
mirror of
https://github.com/uptrace/go-clickhouse.git
synced 2025-07-05 00:28:55 +02:00
fix: continue working with non UTC timezone
This commit is contained in:
@ -24,7 +24,7 @@ Main features are:
|
||||
|
||||
Unsupported:
|
||||
|
||||
- Server timezones other than UTC.
|
||||
- `DateTime64`
|
||||
|
||||
Resources:
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
package chproto
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type ServerInfo struct {
|
||||
Name string
|
||||
MinorVersion uint64
|
||||
@ -25,18 +21,13 @@ func (srv *ServerInfo) ReadFrom(rd *Reader) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
timezone, err := rd.String()
|
||||
if err != nil {
|
||||
if _, err := rd.String(); err != nil { // timezone
|
||||
return err
|
||||
}
|
||||
if timezone != "UTC" {
|
||||
return fmt.Errorf("ch: ClickHouse server uses timezone=%q, expected UTC", timezone)
|
||||
}
|
||||
|
||||
if _, err = rd.String(); err != nil { // display name
|
||||
if _, err := rd.String(); err != nil { // display name
|
||||
return err
|
||||
}
|
||||
if _, err = rd.Uvarint(); err != nil { // server version patch
|
||||
if _, err := rd.Uvarint(); err != nil { // server version patch
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,10 @@ func AppendString(b []byte, s string) []byte {
|
||||
}
|
||||
|
||||
func AppendTime(b []byte, tm time.Time) []byte {
|
||||
return tm.UTC().AppendFormat(b, "'2006-01-02 15:04:05'")
|
||||
b = append(b, "toDateTime('"...)
|
||||
b = tm.UTC().AppendFormat(b, "2006-01-02 15:04:05")
|
||||
b = append(b, "', 'UTC')"...)
|
||||
return b
|
||||
}
|
||||
|
||||
func AppendBytes(b []byte, bytes []byte) []byte {
|
||||
|
Reference in New Issue
Block a user