package chcol

import "github.com/ClickHouse/clickhouse-go/v2/lib/chcol"

Index

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 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

Source Files

dynamic.go json.go variant.go

Version
v2.30.2
Published
Jan 30, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
48 minutes ago

Tools for package owners.