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