Files
zeekay 0c90ebe02e debrand: finish the rename across source, docs and dev infra
Source: the unexported clickhouse struct becomes client, the ch receiver and
chproto import alias follow, error message prefixes read datastore, and the
JSON serializer interface drops the vendor infix. resources' metadata key and
its accessor are renamed together, with a test proving the embedded YAML still
unmarshals — a silent drift there would have made every connection take the
unsupported-server-version branch.

Codegen: all three templates still emitted the upstream module paths, so
regenerating would have quietly undone the rename. Note the templates have
drifted from the files they produce (regenerating today drops QBit and
scanTypeDuration), so the generated files are left as tracked and only the
templates are corrected.

Dead links: an earlier mechanical pass invented URLs that do not resolve —
github.com/ClickHouse/datastore-go, hanzo-ds/driver issue numbers that belong to
upstream, and mangled names of independent projects (mailru, uptrace, nikepan,
EpicStep). Third-party names are not ours to rewrite, so those directories are
removed rather than repaired, and provenance comments now point at real files.

Dev infra: compose runs our own server image at the tag production runs, since
the vendor's alpine tag does not exist in our registry. Cluster hostnames,
nginx upstreams and server configs are renamed as one set.

CHANGELOG.md is upstream's release history for versions this module never
released; rewriting it would fabricate a lineage, so it is dropped and the
upstream base recorded in README instead.

The two long-standing vet findings are fixed by keying the struct literals
rather than suppressed. LICENSE and contributors/list keep the vendor name on
purpose: one is the copyright notice Apache-2.0 requires, the other is real
people's names. CI now enforces build, vet, test, gofmt and a grep gate.
2026-07-26 11:46:39 -07:00

61 lines
2.2 KiB
Go

package datastore
import "github.com/hanzo-ds/go/lib/col"
// Re-export col types and funcs to the top level datastore package
type (
// Variant represents a Datastore Variant type that can hold multiple possible types
Variant = col.Variant
// Dynamic is an alias for the Variant type
Dynamic = col.Dynamic
// JSON represents a Datastore JSON type that can hold multiple possible types
JSON = col.JSON
// JSONSerializer interface allows a struct to be manually converted to an optimized JSON structure instead of relying
// on recursive reflection.
// Note that the struct must be a pointer in order for the interface to be matched, reflection will be used otherwise.
JSONSerializer = col.JSONSerializer
// JSONDeserializer interface allows a struct to load its data from an optimized JSON structure instead of relying
// on recursive reflection to set its fields.
JSONDeserializer = col.JSONDeserializer
)
// NewVariant creates a new Variant with the given value
func NewVariant(v any) Variant {
return col.NewVariant(v)
}
// NewVariantWithType creates a new Variant with the given value and Datastore type
func NewVariantWithType(v any, chType string) Variant {
return col.NewVariantWithType(v, chType)
}
// NewDynamic creates a new Dynamic with the given value
func NewDynamic(v any) Dynamic {
return col.NewDynamic(v)
}
// NewDynamicWithType creates a new Dynamic with the given value and Datastore type
func NewDynamicWithType(v any, chType string) Dynamic {
return col.NewDynamicWithType(v, chType)
}
// NewJSON creates a new empty JSON value
func NewJSON() *JSON {
return col.NewJSON()
}
// ExtractJSONPathAs is a convenience function for asserting a path to a specific type.
// The underlying value is also extracted from its Dynamic wrapper if present.
// T cannot be a Dynamic, if you want a Dynamic simply use ExtractJSONPathAsDynamic.
func ExtractJSONPathAs[T any](o *JSON, path string) (valueAs T, ok bool) {
return col.ExtractJSONPathAs[T](o, path)
}
// ExtractJSONPathAsDynamic is a convenience function for asserting a path to a Dynamic.
// If the value is not a Dynamic, the value is wrapped in an untyped Dynamic with false returned.
func ExtractJSONPathAsDynamic(o *JSON, path string) (Dynamic, bool) {
return col.ExtractJSONPathAsDynamic(o, path)
}