package chcol
import "github.com/ClickHouse/clickhouse-go/v2/lib/chcol"
Index ¶
- func ExtractJSONPathAs[T any](o *JSON, path string) (T, bool)
- type Dynamic
- type JSON
- func NewJSON() *JSON
- func (o *JSON) MarshalJSON() ([]byte, error)
- func (o *JSON) NestedMap() map[string]any
- func (o *JSON) Scan(value interface{}) error
- func (o *JSON) SetValueAtPath(path string, value any)
- func (o *JSON) Value() (driver.Value, error)
- func (o *JSON) ValueAtPath(path string) (any, bool)
- func (o *JSON) ValuesByPath() map[string]any
- type JSONDeserializer
- type JSONSerializer
- type Variant
- func NewVariant(v any) Variant
- func NewVariantWithType(v any, chType string) Variant
- func (v Variant) Any() any
- func (v Variant) HasType() bool
- func (v Variant) MarshalJSON() ([]byte, error)
- func (v Variant) MarshalText() ([]byte, error)
- func (v Variant) Nil() bool
- func (v *Variant) Scan(value interface{}) error
- func (v Variant) Type() string
- func (v *Variant) UnmarshalJSON(data []byte) error
- func (v *Variant) UnmarshalText(text []byte) error
- func (v Variant) Value() (driver.Value, error)
- func (v Variant) WithType(chType string) Variant
Functions ¶
func ExtractJSONPathAs ¶
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.
Types ¶
type Dynamic ¶
type Dynamic = Variant
func NewDynamic ¶
NewDynamic creates a new Dynamic with the given value
func NewDynamicWithType ¶
NewDynamicWithType creates a new Dynamic with the given value and ClickHouse type
type JSON ¶
type JSON struct {
// contains filtered or unexported fields
}
JSON represents a ClickHouse JSON type that can hold multiple possible types
func NewJSON ¶
func NewJSON() *JSON
NewJSON creates a new empty JSON value
func (*JSON) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (*JSON) NestedMap ¶
NestedMap converts the flattened JSON data into a nested structure
func (*JSON) Scan ¶
Scan implements the sql.Scanner interface
func (*JSON) SetValueAtPath ¶
func (*JSON) Value ¶
Value implements the driver.Valuer interface
func (*JSON) ValueAtPath ¶
func (*JSON) ValuesByPath ¶
type JSONDeserializer ¶
JSONDeserializer interface allows a struct to load its data from an optimized JSON structure instead of relying on recursive reflection to set its fields.
type JSONSerializer ¶
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.
type Variant ¶
type Variant struct {
// contains filtered or unexported fields
}
Variant represents a ClickHouse Variant type that can hold multiple possible types
func NewVariant ¶
NewVariant creates a new Variant with the given value
func NewVariantWithType ¶
NewVariantWithType creates a new Variant with the given value and ClickHouse type
func (Variant) Any ¶
Any returns the underlying value as any.
func (Variant) HasType ¶
HasType returns true if the value has a type ClickHouse included.
func (Variant) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
func (Variant) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface
func (Variant) Nil ¶
Nil returns true if the underlying value is nil.
func (*Variant) Scan ¶
Scan implements the sql.Scanner interface
func (Variant) Type ¶
Type returns the ClickHouse type as a string.
func (*Variant) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface
func (*Variant) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface
func (Variant) Value ¶
Value implements the driver.Valuer interface
func (Variant) WithType ¶
WithType creates a new Variant with the current value and given ClickHouse type
Source Files ¶
- Version
- v2.34.0 (latest)
- Published
- Apr 1, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 4 minutes ago –
Tools for package owners.