clickhousex

package module
v0.0.0-...-e90554c Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

clickhousex

ClickHouse driver extension for Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToChPrimitiveType

func ToChPrimitiveType(t reflect.Type) (string, error)

func ToChType

func ToChType(t reflect.Type) (string, error)

func ToTableName

func ToTableName(s string) string

Types

type BaseModel

type BaseModel struct {
	Type      reflect.Type
	Dsn       string
	Pool      *sql.DB
	Database  string
	TableName string
	// contains filtered or unexported fields
}

func NewBaseModel

func NewBaseModel(dsn string, data interface{}) (*BaseModel, error)

func NewBaseModelWithCreated

func NewBaseModelWithCreated(dsn string, data interface{}) (*BaseModel, bool, error)

func (*BaseModel) Clear

func (b *BaseModel) Clear() error

func (*BaseModel) CountWhere

func (b *BaseModel) CountWhere(where string, args ...interface{}) (int64, error)

func (*BaseModel) Delete

func (b *BaseModel) Delete(id interface{}) (int64, error)

func (*BaseModel) DeleteWhere

func (b *BaseModel) DeleteWhere(where string, args ...interface{}) (int64, error)

func (*BaseModel) Exists

func (b *BaseModel) Exists(id interface{}) (bool, error)

func (*BaseModel) ExistsWhere

func (b *BaseModel) ExistsWhere(where string, args ...interface{}) (bool, error)

func (*BaseModel) Find

func (b *BaseModel) Find(id interface{}) (interface{}, error)

Find finds a document (*struct type) by id

func (*BaseModel) FindWhere

func (b *BaseModel) FindWhere(where string, args ...interface{}) (interface{}, error)

FindWhere finds a document (*struct type) that matches 'where' condition

func (*BaseModel) GetCreateTableSQL

func (b *BaseModel) GetCreateTableSQL(indexes map[string]string) string

func (*BaseModel) GetInsertSQL

func (b *BaseModel) GetInsertSQL() ([]int, string)

GetInsertSQL returns insert SQL without returning id

func (*BaseModel) GetSelectSQL

func (b *BaseModel) GetSelectSQL() ([]int, string)

GetSelectSQL returns fieldIndexes, and select SQL

func (*BaseModel) InsertAll

func (b *BaseModel) InsertAll(vs interface{}) error

InsertAll inserts vs ([]*struct or []struct type)

func (*BaseModel) QueryWhere

func (b *BaseModel) QueryWhere(where string, args ...interface{}) (interface{}, error)

QueryWhere queries documents ([]*struct type) that matches 'where' condition

func (*BaseModel) Truncate

func (b *BaseModel) Truncate() error

func (*BaseModel) UpdateSet

func (b *BaseModel) UpdateSet(sets string, where string, args ...interface{}) (int64, error)

type Column

type Column struct {
	Name              string `db:"name"`
	Type              string `db:"type"`
	DefaultType       string `db:"default_type"`
	DefaultExpression string `db:"default_expression"`
	Comment           string `db:"comment"`
	CodecExpression   string `db:"codec_expression"`
	TTLExpression     string `db:"ttl_expression"`
}

func DescTable

func DescTable(pool *sql.DB, database, tableName string) ([]Column, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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