Files
zeekay ef352c1051 debrand: rename the wire client name, prose and linter config
proto.Name is sent in ClientHello and lands in the server's system.query_log,
so it is wire visible; it now reads datastore/native and is covered by a test.
Verified against the live server: the handshake succeeds and the new name
appears in query_log.

goimports' local-prefixes still named the upstream module, so it was not
grouping this module's own imports.

Doc comments, the deprecated-error markers in proto/error_codes.go and the
package prose are swept. Dead references are removed rather than repointed:
go-faster.org/docs/clickhouse and the mangled Datastore/clickhouse-cpp link
both 404, and the list of other vendors' clients does not belong here.

Four things deliberately keep the vendor name, and CI records why:
LICENSE and AUTHORS are the copyright notices Apache-2.0 requires; db.system in
query.go is an OpenTelemetry enum whose registered value for this DBMS is fixed
by the specification, so emitting anything else would be non-conformant; and
README names clickhouse-local, which is genuinely the binary our own server
image ships.

Numeric error codes and protocol revision constants are untouched.
2026-07-26 11:50:36 -07:00

39 lines
897 B
Go

package proto
import "time"
// Date32 represents Date32 value.
//
// https://docs.hanzo.ai/datastore
type Date32 int32
// Unix returns unix timestamp of Date32.
//
// You can use time.Unix(d.Unix(), 0) to get Time in time.Local location.
func (d Date32) Unix() int64 {
return secInDay * int64(d)
}
// Time returns UTC starting time.Time of Date32.
func (d Date32) Time() time.Time {
return time.Unix(d.Unix(), 0).UTC()
}
func (d Date32) String() string {
return d.Time().Format(DateLayout)
}
// ToDate32 returns Date32 of time.Time.
func ToDate32(t time.Time) Date32 {
if t.IsZero() {
return 0
}
_, offset := t.Zone()
return Date32((t.Unix() + int64(offset)) / secInDay)
}
// NewDate32 returns the Date32 corresponding to year, month and day in UTC.
func NewDate32(year int, month time.Month, day int) Date32 {
return ToDate32(time.Date(year, month, day, 0, 0, 0, 0, time.UTC))
}