Documentation ¶
Index ¶
- func Append(fmter Formatter, b []byte, v any) []byte
- func AppendBool(dst []byte, v bool) []byte
- func AppendBytes(b []byte, bytes []byte) []byte
- func AppendError(b []byte, err error) []byte
- func AppendFQN(b []byte, field string) []byte
- func AppendFloat(dst []byte, v float64) []byte
- func AppendIdent(b []byte, field string) []byte
- func AppendNull(b []byte) []byte
- func AppendQuery(b []byte, query string, args ...any) []byte
- func AppendQueryAppender(fmter Formatter, b []byte, app QueryAppender) []byte
- func AppendString(b []byte, s string) []byte
- func AppendTime(b []byte, tm time.Time) []byte
- func AppendValue(fmter Formatter, b []byte, v reflect.Value) []byte
- func FormatQuery(query string, args ...any) string
- func SetTableNameInflector(fn func(string) string)
- type AfterScanRowHook
- type AppenderFunc
- type ArrayColumn
- func (c *ArrayColumn) AppendValue(v reflect.Value)
- func (c *ArrayColumn) ConvertAssign(idx int, v reflect.Value) error
- func (c *ArrayColumn) Index(idx int) any
- func (c *ArrayColumn) Len() int
- func (c *ArrayColumn) Nullable(nulls Uint8Column) any
- func (c *ArrayColumn) ReadFrom(rd *chproto.Reader, numRow int) error
- func (c *ArrayColumn) Reset(numRow int)
- func (c *ArrayColumn) Set(v any)
- func (c ArrayColumn) Slice(s, e int) any
- func (c ArrayColumn) Type() reflect.Type
- func (c *ArrayColumn) Value() any
- func (c *ArrayColumn) WriteOffset(wr *chproto.Writer, offset int) int
- func (c *ArrayColumn) WriteTo(wr *chproto.Writer) error
- type ArrayColumnar
- type ArrayLCStringColumn
- type Block
- type BoolColumn
- type BytesColumn
- func (c *BytesColumn) AppendValue(v reflect.Value)
- func (c BytesColumn) ConvertAssign(idx int, v reflect.Value) error
- func (c *BytesColumn) ReadFrom(rd *chproto.Reader, numRow int) error
- func (c *BytesColumn) Reset(numRow int)
- func (c BytesColumn) Type() reflect.Type
- func (c BytesColumn) WriteTo(wr *chproto.Writer) error
- type CHModel
- type Column
- type ColumnOf
- func (c *ColumnOf[T]) Alloc(numRow int)
- func (c *ColumnOf[T]) AppendValue(v reflect.Value)
- func (c *ColumnOf[T]) ConvertAssign(idx int, dest reflect.Value) error
- func (c ColumnOf[T]) Index(idx int) any
- func (c ColumnOf[T]) Len() int
- func (c ColumnOf[T]) Nullable(nulls Uint8Column) any
- func (c *ColumnOf[T]) Reset(numRow int)
- func (c *ColumnOf[T]) Set(v any)
- func (c ColumnOf[T]) Slice(s, e int) any
- func (c ColumnOf[T]) Value() any
- type Columnar
- func NewArrayColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewBoolColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewBytesColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewColumnFromCHType(chType string, numRow int) Columnar
- func NewDateColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewDateTimeColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewEnumColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewFloat32Column(typ reflect.Type, chType string, numRow int) Columnar
- func NewFloat64Column(typ reflect.Type, chType string, numRow int) Columnar
- func NewIPColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewInt16Column(typ reflect.Type, chType string, numRow int) Columnar
- func NewInt32Column(typ reflect.Type, chType string, numRow int) Columnar
- func NewInt64Column(typ reflect.Type, chType string, numRow int) Columnar
- func NewInt64TimeColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewInt8Column(typ reflect.Type, chType string, numRow int) Columnar
- func NewJSONColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewLCStringColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewStringArrayColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewStringColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewTimeColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewUUIDColumn(typ reflect.Type, chType string, numRow int) Columnar
- func NewUint16Column(typ reflect.Type, chType string, numRow int) Columnar
- func NewUint32Column(typ reflect.Type, chType string, numRow int) Columnar
- func NewUint64Column(typ reflect.Type, chType string, numRow int) Columnar
- func NewUint8Column(typ reflect.Type, chType string, numRow int) Columnar
- type ColumnsAppender
- type DateColumn
- type DateTimeColumn
- type EnumColumn
- type FQN
- type Field
- type Float32Column
- type Float64Column
- type Formatter
- func (f Formatter) AppendIdent(b []byte, ident string) []byte
- func (f Formatter) AppendQuery(b []byte, query string, args ...any) []byte
- func (f Formatter) FormatQuery(query string, args ...any) string
- func (f Formatter) WithArg(arg NamedArgAppender) Formatter
- func (f Formatter) WithNamedArg(name string, value any) Formatter
- type IPColumn
- type Ident
- type Int16Column
- type Int32Column
- type Int64Column
- type Int64TimeColumn
- type Int8Column
- type JSONColumn
- type LCStringColumn
- type Model
- type NamedArgAppender
- type NewColumnFunc
- type NullableColumn
- func (c *NullableColumn) AppendValue(v reflect.Value)
- func (c *NullableColumn) ConvertAssign(idx int, dest reflect.Value) error
- func (c *NullableColumn) Index(idx int) any
- func (c *NullableColumn) Len() int
- func (c *NullableColumn) Nullable(nulls Uint8Column) any
- func (c *NullableColumn) ReadFrom(rd *chproto.Reader, numRow int) error
- func (c *NullableColumn) Set(v any)
- func (c *NullableColumn) Slice(s, e int) any
- func (c *NullableColumn) Type() reflect.Type
- func (c *NullableColumn) Value() any
- func (c *NullableColumn) WriteTo(wr *chproto.Writer) error
- type NumericColumnOf
- type Query
- type QueryAppender
- type QueryWithArgs
- type QueryWithSep
- type Safe
- type StringArrayColumn
- func (c *StringArrayColumn) AppendValue(v reflect.Value)
- func (c *StringArrayColumn) ConvertAssign(idx int, v reflect.Value) error
- func (c *StringArrayColumn) Index(idx int) any
- func (c *StringArrayColumn) Len() int
- func (c *StringArrayColumn) Nullable(nulls Uint8Column) any
- func (c *StringArrayColumn) ReadFrom(rd *chproto.Reader, numRow int) error
- func (c *StringArrayColumn) Reset(numRow int)
- func (c *StringArrayColumn) Set(v any)
- func (c StringArrayColumn) Slice(s, e int) any
- func (c *StringArrayColumn) Type() reflect.Type
- func (c *StringArrayColumn) Value() any
- func (c *StringArrayColumn) WriteData(wr *chproto.Writer) error
- func (c *StringArrayColumn) WriteOffset(wr *chproto.Writer, offset int) int
- func (c *StringArrayColumn) WriteTo(wr *chproto.Writer) error
- type StringColumn
- type Table
- func (t *Table) AppendNamedArg(fmter Formatter, b []byte, name string, strct reflect.Value) ([]byte, bool)
- func (t *Table) Field(name string) (*Field, error)
- func (t *Table) HasAfterScanRowHook() bool
- func (t *Table) IsColumnar() bool
- func (t *Table) NewColumn(colName, colType string, numRow int) *Column
- func (t *Table) String() string
- type TimeColumn
- type UUID
- type UUIDColumn
- type Uint16Column
- type Uint32Column
- type Uint64Column
- type Uint8Column
- type UnknownColumnError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendBool ¶
func AppendBytes ¶
func AppendError ¶
func AppendFloat ¶
func AppendIdent ¶
func AppendNull ¶
func AppendQueryAppender ¶
func AppendQueryAppender(fmter Formatter, b []byte, app QueryAppender) []byte
func AppendString ¶
func FormatQuery ¶
func SetTableNameInflector ¶
SetTableNameInflector overrides the default func that pluralizes model name to get table name, e.g. my_article becomes my_articles.
Types ¶
type AfterScanRowHook ¶
type AppenderFunc ¶
func Appender ¶
func Appender(typ reflect.Type) AppenderFunc
type ArrayColumn ¶
func (*ArrayColumn) AppendValue ¶
func (c *ArrayColumn) AppendValue(v reflect.Value)
func (*ArrayColumn) ConvertAssign ¶
func (c *ArrayColumn) ConvertAssign(idx int, v reflect.Value) error
func (*ArrayColumn) Index ¶
func (c *ArrayColumn) Index(idx int) any
func (*ArrayColumn) Len ¶
func (c *ArrayColumn) Len() int
func (*ArrayColumn) Nullable ¶
func (c *ArrayColumn) Nullable(nulls Uint8Column) any
func (*ArrayColumn) Reset ¶
func (c *ArrayColumn) Reset(numRow int)
func (*ArrayColumn) Set ¶
func (c *ArrayColumn) Set(v any)
func (ArrayColumn) Slice ¶
func (c ArrayColumn) Slice(s, e int) any
func (ArrayColumn) Type ¶
func (c ArrayColumn) Type() reflect.Type
func (*ArrayColumn) Value ¶
func (c *ArrayColumn) Value() any
func (*ArrayColumn) WriteOffset ¶
func (c *ArrayColumn) WriteOffset(wr *chproto.Writer, offset int) int
type ArrayColumnar ¶
type ArrayLCStringColumn ¶
type ArrayLCStringColumn struct {
*LCStringColumn
}
func (*ArrayLCStringColumn) ReadFrom ¶
func (c *ArrayLCStringColumn) ReadFrom(rd *chproto.Reader, numRow int) error
func (ArrayLCStringColumn) Type ¶
func (c ArrayLCStringColumn) Type() reflect.Type
type Block ¶
type Block struct { Table *Table NumColumn int // read-only NumRow int // read-only Columns []*Column // contains filtered or unexported fields }
func (*Block) ColumnForField ¶
type BoolColumn ¶
func (*BoolColumn) AppendValue ¶
func (c *BoolColumn) AppendValue(v reflect.Value)
func (BoolColumn) ConvertAssign ¶
func (c BoolColumn) ConvertAssign(idx int, v reflect.Value) error
func (BoolColumn) Type ¶
func (c BoolColumn) Type() reflect.Type
type BytesColumn ¶
func (*BytesColumn) AppendValue ¶
func (c *BytesColumn) AppendValue(v reflect.Value)
func (BytesColumn) ConvertAssign ¶
func (c BytesColumn) ConvertAssign(idx int, v reflect.Value) error
func (*BytesColumn) Reset ¶
func (c *BytesColumn) Reset(numRow int)
func (BytesColumn) Type ¶
func (c BytesColumn) Type() reflect.Type
type ColumnOf ¶
type ColumnOf[T any] struct { Column []T }
func NewColumnOf ¶
func (*ColumnOf[T]) AppendValue ¶
func (*ColumnOf[T]) ConvertAssign ¶
func (ColumnOf[T]) Nullable ¶
func (c ColumnOf[T]) Nullable(nulls Uint8Column) any
type Columnar ¶
type Columnar interface { ReadFrom(rd *chproto.Reader, numRow int) error WriteTo(wr *chproto.Writer) error Type() reflect.Type Set(v any) AppendValue(v reflect.Value) Value() any Nullable(nulls Uint8Column) any Len() int Index(idx int) any Slice(s, e int) any ConvertAssign(idx int, dest reflect.Value) error }
func NewColumnFromCHType ¶
func NewDateTimeColumn ¶
func NewInt64TimeColumn ¶
func NewLCStringColumn ¶
func NewStringArrayColumn ¶
type ColumnsAppender ¶
type DateColumn ¶
type DateColumn struct {
DateTimeColumn
}
type DateTimeColumn ¶
func (*DateTimeColumn) AppendValue ¶
func (c *DateTimeColumn) AppendValue(v reflect.Value)
func (DateTimeColumn) ConvertAssign ¶
func (c DateTimeColumn) ConvertAssign(idx int, v reflect.Value) error
func (*DateTimeColumn) ReadFrom ¶
func (c *DateTimeColumn) ReadFrom(rd *chproto.Reader, numRow int) error
func (DateTimeColumn) Type ¶
func (c DateTimeColumn) Type() reflect.Type
type EnumColumn ¶
type EnumColumn struct { StringColumn // contains filtered or unexported fields }
type FQN ¶
type FQN string
FQN represents a fully qualified SQL name, for example, table or column name.
type Field ¶
type Field struct { Field reflect.StructField Type reflect.Type Index []int GoName string // struct field name, e.g. Id CHName string // SQL name, .e.g. id Column Safe // escaped SQL name, e.g. "id" CHType string CHDefault Safe NewColumn NewColumnFunc IsPK bool NotNull bool // contains filtered or unexported fields }
func (*Field) AppendValue ¶
type Float32Column ¶
type Float32Column struct { NumericColumnOf[float32] }
func (*Float32Column) AppendValue ¶
func (c *Float32Column) AppendValue(v reflect.Value)
func (*Float32Column) ReadFrom ¶
func (c *Float32Column) ReadFrom(rd *chproto.Reader, numRow int) error
func (Float32Column) Type ¶
func (c Float32Column) Type() reflect.Type
type Float64Column ¶
type Float64Column struct { NumericColumnOf[float64] }
func (*Float64Column) AppendValue ¶
func (c *Float64Column) AppendValue(v reflect.Value)
func (*Float64Column) ReadFrom ¶
func (c *Float64Column) ReadFrom(rd *chproto.Reader, numRow int) error
func (Float64Column) Type ¶
func (c Float64Column) Type() reflect.Type
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
func NewFormatter ¶
func NewFormatter() Formatter
func (Formatter) AppendQuery ¶
func (Formatter) WithArg ¶
func (f Formatter) WithArg(arg NamedArgAppender) Formatter
type IPColumn ¶
func (*IPColumn) AppendValue ¶
type Ident ¶
type Ident string
Ident represents a SQL identifier, for example, table or column name.
type Int16Column ¶
type Int16Column struct { NumericColumnOf[int16] }
func (*Int16Column) AppendValue ¶
func (c *Int16Column) AppendValue(v reflect.Value)
func (Int16Column) Type ¶
func (c Int16Column) Type() reflect.Type
type Int32Column ¶
type Int32Column struct { NumericColumnOf[int32] }
func (*Int32Column) AppendValue ¶
func (c *Int32Column) AppendValue(v reflect.Value)
func (Int32Column) Type ¶
func (c Int32Column) Type() reflect.Type
type Int64Column ¶
type Int64Column struct { NumericColumnOf[int64] }
func (*Int64Column) AppendValue ¶
func (c *Int64Column) AppendValue(v reflect.Value)
func (Int64Column) Type ¶
func (c Int64Column) Type() reflect.Type
type Int64TimeColumn ¶
type Int64TimeColumn struct {
Int64Column
}
type Int8Column ¶
type Int8Column struct { NumericColumnOf[int8] }
func (*Int8Column) AppendValue ¶
func (c *Int8Column) AppendValue(v reflect.Value)
func (Int8Column) Type ¶
func (c Int8Column) Type() reflect.Type
type JSONColumn ¶
type JSONColumn struct { BytesColumn Values []reflect.Value }
func (*JSONColumn) AppendValue ¶
func (c *JSONColumn) AppendValue(v reflect.Value)
func (*JSONColumn) ConvertAssign ¶
func (c *JSONColumn) ConvertAssign(idx int, v reflect.Value) error
func (*JSONColumn) Len ¶
func (c *JSONColumn) Len() int
func (*JSONColumn) Reset ¶
func (c *JSONColumn) Reset(numRow int)
type LCStringColumn ¶
type LCStringColumn struct {
StringColumn
}
type NamedArgAppender ¶
type NewColumnFunc ¶
func ColumnFactory ¶
func ColumnFactory(typ reflect.Type, chType string) NewColumnFunc
keep in sync with clickhouseType
func NullableNewColumnFunc ¶
func NullableNewColumnFunc(fn NewColumnFunc) NewColumnFunc
type NullableColumn ¶
type NullableColumn struct { Nulls Uint8Column Values Columnar // contains filtered or unexported fields }
func (*NullableColumn) AppendValue ¶
func (c *NullableColumn) AppendValue(v reflect.Value)
func (*NullableColumn) ConvertAssign ¶
func (c *NullableColumn) ConvertAssign(idx int, dest reflect.Value) error
func (*NullableColumn) Index ¶
func (c *NullableColumn) Index(idx int) any
func (*NullableColumn) Len ¶
func (c *NullableColumn) Len() int
func (*NullableColumn) Nullable ¶
func (c *NullableColumn) Nullable(nulls Uint8Column) any
func (*NullableColumn) ReadFrom ¶
func (c *NullableColumn) ReadFrom(rd *chproto.Reader, numRow int) error
func (*NullableColumn) Set ¶
func (c *NullableColumn) Set(v any)
func (*NullableColumn) Slice ¶
func (c *NullableColumn) Slice(s, e int) any
func (*NullableColumn) Type ¶
func (c *NullableColumn) Type() reflect.Type
func (*NullableColumn) Value ¶
func (c *NullableColumn) Value() any
type NumericColumnOf ¶
type NumericColumnOf[T constraints.Integer | constraints.Float] struct { ColumnOf[T] }
func NewNumericColumnOf ¶
func NewNumericColumnOf[T constraints.Integer | constraints.Float](numRow int) NumericColumnOf[T]
func (NumericColumnOf[T]) ConvertAssign ¶
func (c NumericColumnOf[T]) ConvertAssign(idx int, v reflect.Value) error
type Query ¶
type Query interface { QueryAppender Operation() string GetModel() Model GetTableName() string }
type QueryAppender ¶
type QueryWithArgs ¶
func SafeQuery ¶
func SafeQuery(query string, args []any) QueryWithArgs
func UnsafeIdent ¶
func UnsafeIdent(ident string) QueryWithArgs
func (QueryWithArgs) AppendQuery ¶
func (q QueryWithArgs) AppendQuery(fmter Formatter, b []byte) ([]byte, error)
func (QueryWithArgs) IsZero ¶
func (q QueryWithArgs) IsZero() bool
func (QueryWithArgs) Value ¶
func (q QueryWithArgs) Value() Safe
type QueryWithSep ¶
type QueryWithSep struct { QueryWithArgs Sep string }
func SafeQueryWithSep ¶
func SafeQueryWithSep(query string, args []any, sep string) QueryWithSep
type StringArrayColumn ¶
type StringArrayColumn struct { Column [][]string // contains filtered or unexported fields }
func (*StringArrayColumn) AppendValue ¶
func (c *StringArrayColumn) AppendValue(v reflect.Value)
func (*StringArrayColumn) ConvertAssign ¶
func (c *StringArrayColumn) ConvertAssign(idx int, v reflect.Value) error
func (*StringArrayColumn) Index ¶
func (c *StringArrayColumn) Index(idx int) any
func (*StringArrayColumn) Len ¶
func (c *StringArrayColumn) Len() int
func (*StringArrayColumn) Nullable ¶
func (c *StringArrayColumn) Nullable(nulls Uint8Column) any
func (*StringArrayColumn) ReadFrom ¶
func (c *StringArrayColumn) ReadFrom(rd *chproto.Reader, numRow int) error
func (*StringArrayColumn) Reset ¶
func (c *StringArrayColumn) Reset(numRow int)
func (*StringArrayColumn) Set ¶
func (c *StringArrayColumn) Set(v any)
func (StringArrayColumn) Slice ¶
func (c StringArrayColumn) Slice(s, e int) any
func (*StringArrayColumn) Type ¶
func (c *StringArrayColumn) Type() reflect.Type
func (*StringArrayColumn) Value ¶
func (c *StringArrayColumn) Value() any
func (*StringArrayColumn) WriteData ¶
func (c *StringArrayColumn) WriteData(wr *chproto.Writer) error
func (*StringArrayColumn) WriteOffset ¶
func (c *StringArrayColumn) WriteOffset(wr *chproto.Writer, offset int) int
type StringColumn ¶
func (*StringColumn) AppendValue ¶
func (c *StringColumn) AppendValue(v reflect.Value)
func (StringColumn) ConvertAssign ¶
func (c StringColumn) ConvertAssign(idx int, v reflect.Value) error
func (*StringColumn) ReadFrom ¶
func (c *StringColumn) ReadFrom(rd *chproto.Reader, numRow int) error
func (StringColumn) Type ¶
func (c StringColumn) Type() reflect.Type
type Table ¶
type Table struct { Type reflect.Type ModelName string Name string CHName Safe CHInsertName Safe CHAlias Safe CHEngine string CHPartition string Fields []*Field // PKs + DataFields PKs []*Field DataFields []*Field FieldMap map[string]*Field // contains filtered or unexported fields }
func TableForType ¶
func (*Table) AppendNamedArg ¶
func (*Table) HasAfterScanRowHook ¶
func (*Table) IsColumnar ¶
type TimeColumn ¶
type TimeColumn struct {
DateTimeColumn
}
type UUIDColumn ¶
TODO: rework to use []byte
func (*UUIDColumn) AppendValue ¶
func (c *UUIDColumn) AppendValue(v reflect.Value)
func (UUIDColumn) ConvertAssign ¶
func (c UUIDColumn) ConvertAssign(idx int, v reflect.Value) error
func (UUIDColumn) Type ¶
func (c UUIDColumn) Type() reflect.Type
type Uint16Column ¶
type Uint16Column struct { NumericColumnOf[uint16] }
func (*Uint16Column) AppendValue ¶
func (c *Uint16Column) AppendValue(v reflect.Value)
func (*Uint16Column) ReadFrom ¶
func (c *Uint16Column) ReadFrom(rd *chproto.Reader, numRow int) error
func (Uint16Column) Type ¶
func (c Uint16Column) Type() reflect.Type
type Uint32Column ¶
type Uint32Column struct { NumericColumnOf[uint32] }
func (*Uint32Column) AppendValue ¶
func (c *Uint32Column) AppendValue(v reflect.Value)
func (*Uint32Column) ReadFrom ¶
func (c *Uint32Column) ReadFrom(rd *chproto.Reader, numRow int) error
func (Uint32Column) Type ¶
func (c Uint32Column) Type() reflect.Type
type Uint64Column ¶
type Uint64Column struct { NumericColumnOf[uint64] }
func (*Uint64Column) AppendValue ¶
func (c *Uint64Column) AppendValue(v reflect.Value)
func (*Uint64Column) ReadFrom ¶
func (c *Uint64Column) ReadFrom(rd *chproto.Reader, numRow int) error
func (Uint64Column) Type ¶
func (c Uint64Column) Type() reflect.Type
type Uint8Column ¶
type Uint8Column struct { NumericColumnOf[uint8] }
func (*Uint8Column) AppendValue ¶
func (c *Uint8Column) AppendValue(v reflect.Value)
func (Uint8Column) Type ¶
func (c Uint8Column) Type() reflect.Type
type UnknownColumnError ¶
func (*UnknownColumnError) Error ¶
func (err *UnknownColumnError) Error() string
Click to show internal directories.
Click to hide internal directories.