mirror of
https://github.com/hanzo-ds/native.git
synced 2026-10-30 20:00:34 +00:00
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.
22 lines
446 B
Go
22 lines
446 B
Go
package proto
|
|
|
|
import "time"
|
|
|
|
// DateTime represents DateTime type.
|
|
type DateTime uint32
|
|
|
|
// ToDateTime converts time.Time to DateTime.
|
|
func ToDateTime(t time.Time) DateTime {
|
|
if t.IsZero() {
|
|
return 0
|
|
}
|
|
return DateTime(t.Unix())
|
|
}
|
|
|
|
// Time returns DateTime as time.Time.
|
|
func (d DateTime) Time() time.Time {
|
|
// https://docs.hanzo.ai/datastore
|
|
// Datastore stores UTC timestamps that are timezone-agnostic.
|
|
return time.Unix(int64(d), 0)
|
|
}
|