chcol

package
v2.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractJSONPathAs added in v2.31.0

func ExtractJSONPathAs[T any](o *JSON, path string) (T, bool)

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

func NewDynamic(v any) Dynamic

NewDynamic creates a new Dynamic with the given value

func NewDynamicWithType

func NewDynamicWithType(v any, chType string) Dynamic

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

func (o *JSON) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*JSON) NestedMap

func (o *JSON) NestedMap() map[string]any

NestedMap converts the flattened JSON data into a nested structure

func (*JSON) Scan

func (o *JSON) Scan(value interface{}) error

Scan implements the sql.Scanner interface

func (*JSON) SetValueAtPath

func (o *JSON) SetValueAtPath(path string, value any)

func (*JSON) Value

func (o *JSON) Value() (driver.Value, error)

Value implements the driver.Valuer interface

func (*JSON) ValueAtPath

func (o *JSON) ValueAtPath(path string) (any, bool)

func (*JSON) ValuesByPath

func (o *JSON) ValuesByPath() map[string]any

type JSONDeserializer added in v2.31.0

type JSONDeserializer interface {
	DeserializeClickHouseJSON(*JSON) error
}

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 added in v2.31.0

type JSONSerializer interface {
	SerializeClickHouseJSON() (*JSON, error)
}

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

func NewVariant(v any) Variant

NewVariant creates a new Variant with the given value

func NewVariantWithType

func NewVariantWithType(v any, chType string) Variant

NewVariantWithType creates a new Variant with the given value and ClickHouse type

func (Variant) Any

func (v Variant) Any() any

Any returns the underlying value as any.

func (Variant) HasType

func (v Variant) HasType() bool

HasType returns true if the value has a type ClickHouse included.

func (Variant) MarshalJSON

func (v Variant) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (Variant) MarshalText

func (v Variant) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface

func (Variant) Nil

func (v Variant) Nil() bool

Nil returns true if the underlying value is nil.

func (*Variant) Scan

func (v *Variant) Scan(value interface{}) error

Scan implements the sql.Scanner interface

func (Variant) Type

func (v Variant) Type() string

Type returns the ClickHouse type as a string.

func (*Variant) UnmarshalJSON

func (v *Variant) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*Variant) UnmarshalText

func (v *Variant) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface

func (Variant) Value

func (v Variant) Value() (driver.Value, error)

Value implements the driver.Valuer interface

func (Variant) WithType

func (v Variant) WithType(chType string) Variant

WithType creates a new Variant with the current value and given ClickHouse type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL