Documentation
¶
Index ¶
- func ExampleAggregations()
- func ExampleBasicUsage()
- func ExampleBatchOperations()
- func ExampleCluster()
- func ExampleJoins()
- func ExampleMigrations()
- func ExampleQueryBuilder()
- func ExampleReplicatedTable()
- func ExampleTransactions()
- func ExampleWindowFunctions()
- type Aggregate
- func (a *Aggregate) All(ctx context.Context, result interface{}) error
- func (a *Aggregate) Any(field string) *Aggregate
- func (a *Aggregate) ArgMax(arg, val string) *Aggregate
- func (a *Aggregate) ArgMin(arg, val string) *Aggregate
- func (a *Aggregate) Avg(field string) *Aggregate
- func (a *Aggregate) Corr(x, y string) *Aggregate
- func (a *Aggregate) Count(field string) *Aggregate
- func (a *Aggregate) CountDistinct(field string) *Aggregate
- func (a *Aggregate) CovarPop(x, y string) *Aggregate
- func (a *Aggregate) CovarSamp(x, y string) *Aggregate
- func (a *Aggregate) Entropy(field string) *Aggregate
- func (a *Aggregate) GeometricMean(field string) *Aggregate
- func (a *Aggregate) Get(ctx context.Context, result interface{}) error
- func (a *Aggregate) GroupArray(field string) *Aggregate
- func (a *Aggregate) GroupUniqArray(field string) *Aggregate
- func (a *Aggregate) HarmonicMean(field string) *Aggregate
- func (a *Aggregate) Histogram(bins int, field string) *Aggregate
- func (a *Aggregate) KurtPop(field string) *Aggregate
- func (a *Aggregate) Max(field string) *Aggregate
- func (a *Aggregate) Median(field string) *Aggregate
- func (a *Aggregate) Min(field string) *Aggregate
- func (a *Aggregate) Quantile(level float64, field string) *Aggregate
- func (a *Aggregate) SkewPop(field string) *Aggregate
- func (a *Aggregate) StdDev(field string) *Aggregate
- func (a *Aggregate) Sum(field string) *Aggregate
- func (a *Aggregate) TopK(k int, field string) *Aggregate
- func (a *Aggregate) TopKWeighted(k int, field, weight string) *Aggregate
- func (a *Aggregate) Uniq(field string) *Aggregate
- func (a *Aggregate) UniqExact(field string) *Aggregate
- func (a *Aggregate) Variance(field string) *Aggregate
- type ClickHouseType
- type Cluster
- type ClusterDB
- func (cdb *ClusterDB) CreateDistributedTable(ctx context.Context, tableName, clusterName, localTableName string, ...) error
- func (cdb *ClusterDB) Exec(ctx context.Context, query string, args ...interface{}) (Result, error)
- func (cdb *ClusterDB) GetConnection(ctx context.Context) (*DB, error)
- func (cdb *ClusterDB) InsertIntoDistributed(ctx context.Context, tableName string, data interface{}) error
- func (cdb *ClusterDB) Query(ctx context.Context, result interface{}, query string, args ...interface{}) error
- type ClusterNode
- type Config
- type DB
- func (db *DB) Begin(ctx context.Context) (*Tx, error)
- func (db *DB) Close() error
- func (db *DB) CreateTable(ctx context.Context, model interface{}) error
- func (db *DB) Exec(ctx context.Context, query string, args ...interface{}) (Result, error)
- func (db *DB) Insert(ctx context.Context, model interface{}) error
- func (db *DB) InsertBatch(ctx context.Context, models []interface{}) error
- func (db *DB) NewQuery() *Query
- func (db *DB) Query(ctx context.Context, result interface{}, query string, args ...interface{}) error
- func (db *DB) QueryRow(ctx context.Context, result interface{}, query string, args ...interface{}) error
- type Engine
- type Error
- type FieldInfo
- type Mapper
- func (m *Mapper) BuildCreateTableSQL(info *TableInfo) string
- func (m *Mapper) GetFieldValue(model interface{}, fieldName string) (interface{}, error)
- func (m *Mapper) GetPrimaryKey(model interface{}) (string, interface{}, error)
- func (m *Mapper) ParseStruct(model interface{}) (*TableInfo, error)
- func (m *Mapper) SetFieldValue(model interface{}, fieldName string, value interface{}) error
- type Migration
- type MigrationFunc
- type MigrationRecord
- type Migrator
- func (m *Migrator) AddMigration(name string, up, down MigrationFunc) *Migrator
- func (m *Migrator) ApplyMigration(ctx context.Context, migration MigrationRecord) error
- func (m *Migrator) CreateMigrationsTable(ctx context.Context) error
- func (m *Migrator) GetAppliedMigrations(ctx context.Context) ([]Migration, error)
- func (m *Migrator) IsMigrationApplied(ctx context.Context, name string) (bool, error)
- func (m *Migrator) Migrate(ctx context.Context) error
- func (m *Migrator) Rollback(ctx context.Context) error
- func (m *Migrator) RollbackMigration(ctx context.Context, name string) error
- func (m *Migrator) Status(ctx context.Context) error
- type Model
- type Order
- type Product
- type Query
- func (q *Query) All(ctx context.Context, result interface{}) error
- func (q *Query) Count(ctx context.Context) (int64, error)
- func (q *Query) Delete(ctx context.Context) (Result, error)
- func (q *Query) Distinct() *Query
- func (q *Query) Exists(ctx context.Context) (bool, error)
- func (q *Query) First(ctx context.Context, result interface{}) error
- func (q *Query) Get(ctx context.Context, result interface{}) error
- func (q *Query) GroupBy(fields ...string) *Query
- func (q *Query) Having(condition string, args ...interface{}) *Query
- func (q *Query) Join(table, condition string, args ...interface{}) *Query
- func (q *Query) Last(ctx context.Context, result interface{}) error
- func (q *Query) LeftJoin(table, condition string, args ...interface{}) *Query
- func (q *Query) Limit(limit int) *Query
- func (q *Query) NewAggregate() *Aggregate
- func (q *Query) NewWindow() *Window
- func (q *Query) Offset(offset int) *Query
- func (q *Query) OrderBy(field string, direction ...string) *Query
- func (q *Query) OrderByAsc(field string) *Query
- func (q *Query) OrderByDesc(field string) *Query
- func (q *Query) Paginate(ctx context.Context, page, perPage int, result interface{}) (int64, error)
- func (q *Query) RightJoin(table, condition string, args ...interface{}) *Query
- func (q *Query) Select(fields ...string) *Query
- func (q *Query) Table(table string) *Query
- func (q *Query) Update(ctx context.Context, data map[string]interface{}) (Result, error)
- func (q *Query) Where(condition string, args ...interface{}) *Query
- func (q *Query) WhereBetween(field string, start, end interface{}) *Query
- func (q *Query) WhereIn(field string, values []interface{}) *Query
- func (q *Query) WhereLike(field, pattern string) *Query
- func (q *Query) WhereNotIn(field string, values []interface{}) *Query
- func (q *Query) WhereNotNull(field string) *Query
- func (q *Query) WhereNull(field string) *Query
- type QueryBuilder
- type ReplicatedTable
- func (rt *ReplicatedTable) AddColumn(name, dataType string) *ReplicatedTable
- func (rt *ReplicatedTable) AddSetting(key, value string) *ReplicatedTable
- func (rt *ReplicatedTable) BuildCreateSQL() string
- func (rt *ReplicatedTable) Create(ctx context.Context, db *DB) error
- func (rt *ReplicatedTable) SetOrderBy(expr string) *ReplicatedTable
- func (rt *ReplicatedTable) SetPartitionBy(expr string) *ReplicatedTable
- func (rt *ReplicatedTable) SetPrimaryKey(expr string) *ReplicatedTable
- func (rt *ReplicatedTable) SetReplicaName(name string) *ReplicatedTable
- func (rt *ReplicatedTable) SetReplicaPath(path string) *ReplicatedTable
- func (rt *ReplicatedTable) SetSampleBy(expr string) *ReplicatedTable
- func (rt *ReplicatedTable) SetTTL(expr string) *ReplicatedTable
- func (rt *ReplicatedTable) SetZooKeeperPath(path string) *ReplicatedTable
- type Result
- type Row
- type Schema
- func (s *Schema) AddColumn(ctx context.Context, tableName, columnName, columnType string) error
- func (s *Schema) CreateDatabase(ctx context.Context, name string) error
- func (s *Schema) CreateIndex(ctx context.Context, indexName, tableName string, columns []string) error
- func (s *Schema) CreateMaterializedView(ctx context.Context, viewName, tableName, selectQuery string) error
- func (s *Schema) CreateTable(ctx context.Context, tableName string, columns []string, engine string, ...) error
- func (s *Schema) DropColumn(ctx context.Context, tableName, columnName string) error
- func (s *Schema) DropDatabase(ctx context.Context, name string) error
- func (s *Schema) DropIndex(ctx context.Context, indexName, tableName string) error
- func (s *Schema) DropMaterializedView(ctx context.Context, viewName string) error
- func (s *Schema) DropTable(ctx context.Context, tableName string) error
- func (s *Schema) GetDatabases(ctx context.Context) ([]string, error)
- func (s *Schema) GetTableInfo(ctx context.Context, tableName string) (map[string]interface{}, error)
- func (s *Schema) GetTables(ctx context.Context) ([]string, error)
- func (s *Schema) ModifyColumn(ctx context.Context, tableName, columnName, newType string) error
- func (s *Schema) RenameColumn(ctx context.Context, tableName, oldName, newName string) error
- func (s *Schema) RenameTable(ctx context.Context, oldName, newName string) error
- func (s *Schema) TruncateTable(ctx context.Context, tableName string) error
- type ShardManager
- type TableInfo
- type Tx
- type User
- type UserStats
- type Window
- func (w *Window) AddToQuery() *Query
- func (w *Window) As(alias string) *Window
- func (w *Window) Build() string
- func (w *Window) CumeDist() *Window
- func (w *Window) DenseRank() *Window
- func (w *Window) FirstValue(field string) *Window
- func (w *Window) Lag(field string, offset int) *Window
- func (w *Window) LastValue(field string) *Window
- func (w *Window) Lead(field string, offset int) *Window
- func (w *Window) NthValue(field string, n int) *Window
- func (w *Window) Ntile(buckets int) *Window
- func (w *Window) Over(partitionBy, orderBy string) *Window
- func (w *Window) PercentRank() *Window
- func (w *Window) Rank() *Window
- func (w *Window) RowNumber() *Window
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExampleAggregations ¶
func ExampleAggregations()
ExampleAggregations демонстрирует использование агрегатных функций
func ExampleBasicUsage ¶
func ExampleBasicUsage()
ExampleBasicUsage демонстрирует базовое использование ORM
func ExampleBatchOperations ¶
func ExampleBatchOperations()
ExampleBatchOperations демонстрирует массовые операции
func ExampleMigrations ¶
func ExampleMigrations()
ExampleMigrations демонстрирует использование миграций
func ExampleQueryBuilder ¶
func ExampleQueryBuilder()
ExampleQueryBuilder демонстрирует использование построителя запросов
func ExampleReplicatedTable ¶
func ExampleReplicatedTable()
ExampleReplicatedTable демонстрирует создание реплицированной таблицы
func ExampleTransactions ¶
func ExampleTransactions()
ExampleTransactions демонстрирует использование транзакций
func ExampleWindowFunctions ¶
func ExampleWindowFunctions()
ExampleWindowFunctions демонстрирует оконные функции
Types ¶
type Aggregate ¶
type Aggregate struct {
// contains filtered or unexported fields
}
Aggregate представляет агрегатную функцию
func (*Aggregate) CountDistinct ¶
CountDistinct добавляет функцию COUNT DISTINCT
func (*Aggregate) GeometricMean ¶
GeometricMean добавляет функцию геометрического среднего
func (*Aggregate) GroupArray ¶
GroupArray добавляет функцию groupArray
func (*Aggregate) GroupUniqArray ¶
GroupUniqArray добавляет функцию groupUniqArray
func (*Aggregate) HarmonicMean ¶
HarmonicMean добавляет функцию гармонического среднего
func (*Aggregate) TopKWeighted ¶
TopKWeighted добавляет функцию topKWeighted
type ClickHouseType ¶
type ClickHouseType string
ClickHouseType представляет типы данных ClickHouse
const ( // Базовые типы TypeUInt8 ClickHouseType = "UInt8" TypeUInt16 ClickHouseType = "UInt16" TypeUInt32 ClickHouseType = "UInt32" TypeUInt64 ClickHouseType = "UInt64" TypeInt8 ClickHouseType = "Int8" TypeInt16 ClickHouseType = "Int16" TypeInt32 ClickHouseType = "Int32" TypeInt64 ClickHouseType = "Int64" TypeFloat32 ClickHouseType = "Float32" TypeFloat64 ClickHouseType = "Float64" TypeString ClickHouseType = "String" TypeFixedString ClickHouseType = "FixedString" TypeDate ClickHouseType = "Date" TypeDateTime ClickHouseType = "DateTime" TypeDateTime64 ClickHouseType = "DateTime64" TypeBoolean ClickHouseType = "Boolean" TypeUUID ClickHouseType = "UUID" // Сложные типы TypeArray ClickHouseType = "Array" TypeNullable ClickHouseType = "Nullable" TypeLowCardinality ClickHouseType = "LowCardinality" TypeEnum ClickHouseType = "Enum" TypeNested ClickHouseType = "Nested" TypeTuple ClickHouseType = "Tuple" TypeMap ClickHouseType = "Map" )
type Cluster ¶
type Cluster struct {
Name string
Nodes []*ClusterNode
// contains filtered or unexported fields
}
Cluster представляет кластер ClickHouse
func (*Cluster) AddNode ¶
func (c *Cluster) AddNode(node *ClusterNode)
AddNode добавляет узел в кластер
func (*Cluster) GetHealthyNodes ¶
func (c *Cluster) GetHealthyNodes() []*ClusterNode
GetHealthyNodes возвращает здоровые узлы
func (*Cluster) GetNodeByWeight ¶
func (c *Cluster) GetNodeByWeight() *ClusterNode
GetNodeByWeight возвращает узел по весу (для балансировки)
func (*Cluster) HealthCheck ¶
HealthCheck проверяет здоровье узлов кластера
func (*Cluster) RemoveNode ¶
RemoveNode удаляет узел из кластера
type ClusterDB ¶
type ClusterDB struct {
// contains filtered or unexported fields
}
ClusterDB представляет подключение к кластеру
func ConnectToCluster ¶
ConnectToCluster подключается к кластеру
func NewClusterDB ¶
NewClusterDB создает новое подключение к кластеру
func (*ClusterDB) CreateDistributedTable ¶
func (cdb *ClusterDB) CreateDistributedTable(ctx context.Context, tableName, clusterName, localTableName string, shardingKey string) error
CreateDistributedTable создает распределенную таблицу
func (*ClusterDB) GetConnection ¶
GetConnection получает подключение к случайному здоровому узлу
type ClusterNode ¶
type ClusterNode struct {
Host string
Port int
Database string
Username string
Password string
Weight int // Вес для балансировки
Healthy bool
LastPing time.Time
}
ClusterNode представляет узел кластера
type Config ¶
type Config struct {
Host string
Port int
Database string
Username string
Password string
MaxOpenConns int
MaxIdleConns int
ConnMaxLifetime time.Duration
TLS bool
Compression bool
Debug bool
}
Config представляет конфигурацию подключения к ClickHouse
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB представляет основное соединение с ClickHouse
func (*DB) CreateTable ¶
CreateTable создает таблицу на основе структуры
func (*DB) InsertBatch ¶
InsertBatch вставляет множество записей
type Engine ¶
type Engine string
Engine представляет движки таблиц ClickHouse
const ( EngineMergeTree Engine = "MergeTree" EngineReplacingMergeTree Engine = "ReplacingMergeTree" EngineSummingMergeTree Engine = "SummingMergeTree" EngineAggregatingMergeTree Engine = "AggregatingMergeTree" EngineCollapsingMergeTree Engine = "CollapsingMergeTree" EngineVersionedCollapsingMergeTree Engine = "VersionedCollapsingMergeTree" EngineGraphiteMergeTree Engine = "GraphiteMergeTree" EngineTinyLog Engine = "TinyLog" EngineLog Engine = "Log" EngineMemory Engine = "Memory" EngineSet Engine = "Set" EngineJoin Engine = "Join" EngineBuffer Engine = "Buffer" EngineMaterializedView Engine = "MaterializedView" )
type Mapper ¶
type Mapper struct {
// contains filtered or unexported fields
}
Mapper представляет маппер для работы со структурами
func (*Mapper) BuildCreateTableSQL ¶
BuildCreateTableSQL строит SQL для создания таблицы
func (*Mapper) GetFieldValue ¶
GetFieldValue получает значение поля из структуры
func (*Mapper) GetPrimaryKey ¶
GetPrimaryKey получает первичный ключ из структуры
func (*Mapper) ParseStruct ¶
ParseStruct парсит структуру и возвращает информацию о таблице
func (*Mapper) SetFieldValue ¶
SetFieldValue устанавливает значение поля в структуре
type Migration ¶
type Migration struct {
ID int64 `ch:"id" ch_type:"UInt64"`
Name string `ch:"name" ch_type:"String"`
AppliedAt time.Time `ch:"applied_at" ch_type:"DateTime"`
Checksum string `ch:"checksum" ch_type:"String"`
}
Migration представляет миграцию
type MigrationFunc ¶
MigrationFunc представляет функцию миграции
type MigrationRecord ¶
type MigrationRecord struct {
Name string
Up MigrationFunc
Down MigrationFunc
Checksum string
}
MigrationRecord представляет запись о миграции
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator представляет мигратор
func (*Migrator) AddMigration ¶
func (m *Migrator) AddMigration(name string, up, down MigrationFunc) *Migrator
AddMigration добавляет миграцию
func (*Migrator) ApplyMigration ¶
func (m *Migrator) ApplyMigration(ctx context.Context, migration MigrationRecord) error
ApplyMigration применяет миграцию
func (*Migrator) CreateMigrationsTable ¶
CreateMigrationsTable создает таблицу для отслеживания миграций
func (*Migrator) GetAppliedMigrations ¶
GetAppliedMigrations получает список примененных миграций
func (*Migrator) IsMigrationApplied ¶
IsMigrationApplied проверяет, применена ли миграция
func (*Migrator) RollbackMigration ¶
RollbackMigration откатывает миграцию
type Order ¶
type Order struct {
ID uint32 `ch:"id" ch_type:"UInt32" ch_pk:"true"`
UserID uint32 `ch:"user_id" ch_type:"UInt32"`
ProductID uint32 `ch:"product_id" ch_type:"UInt32"`
Quantity uint16 `ch:"quantity" ch_type:"UInt16"`
Price float64 `ch:"price" ch_type:"Float64"`
Total float64 `ch:"total" ch_type:"Float64"`
Status string `ch:"status" ch_type:"String"`
Created time.Time `ch:"created" ch_type:"DateTime"`
Completed time.Time `ch:"completed" ch_type:"DateTime"`
}
Order представляет заказ
type Product ¶
type Product struct {
ID uint32 `ch:"id" ch_type:"UInt32" ch_pk:"true"`
Name string `ch:"name" ch_type:"String"`
Description string `ch:"description" ch_type:"String"`
Price float64 `ch:"price" ch_type:"Float64"`
Category string `ch:"category" ch_type:"String"`
InStock bool `ch:"in_stock" ch_type:"Boolean"`
Created time.Time `ch:"created" ch_type:"DateTime"`
}
Product представляет продукт
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query представляет построитель запросов
func (*Query) NewAggregate ¶
NewAggregate создает новый агрегат
func (*Query) OrderByAsc ¶
OrderByAsc добавляет ORDER BY ASC
func (*Query) OrderByDesc ¶
OrderByDesc добавляет ORDER BY DESC
func (*Query) WhereBetween ¶
WhereBetween добавляет условие WHERE BETWEEN
func (*Query) WhereNotIn ¶
WhereNotIn добавляет условие WHERE NOT IN
func (*Query) WhereNotNull ¶
WhereNotNull добавляет условие WHERE IS NOT NULL
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder представляет построитель запросов
type ReplicatedTable ¶
type ReplicatedTable struct {
Name string
ClusterName string
Database string
Engine string
ReplicaPath string
ReplicaName string
ZooKeeperPath string
Columns []string
PartitionBy string
OrderBy string
PrimaryKey string
SampleBy string
TTL string
Settings map[string]string
}
ReplicatedTable представляет реплицированную таблицу
func NewReplicatedTable ¶
func NewReplicatedTable(name, clusterName, database string) *ReplicatedTable
NewReplicatedTable создает новую реплицированную таблицу
func (*ReplicatedTable) AddColumn ¶
func (rt *ReplicatedTable) AddColumn(name, dataType string) *ReplicatedTable
AddColumn добавляет колонку в реплицированную таблицу
func (*ReplicatedTable) AddSetting ¶
func (rt *ReplicatedTable) AddSetting(key, value string) *ReplicatedTable
AddSetting добавляет настройку
func (*ReplicatedTable) BuildCreateSQL ¶
func (rt *ReplicatedTable) BuildCreateSQL() string
BuildCreateSQL строит SQL для создания реплицированной таблицы
func (*ReplicatedTable) Create ¶
func (rt *ReplicatedTable) Create(ctx context.Context, db *DB) error
Create создает реплицированную таблицу
func (*ReplicatedTable) SetOrderBy ¶
func (rt *ReplicatedTable) SetOrderBy(expr string) *ReplicatedTable
SetOrderBy устанавливает ORDER BY
func (*ReplicatedTable) SetPartitionBy ¶
func (rt *ReplicatedTable) SetPartitionBy(expr string) *ReplicatedTable
SetPartitionBy устанавливает PARTITION BY
func (*ReplicatedTable) SetPrimaryKey ¶
func (rt *ReplicatedTable) SetPrimaryKey(expr string) *ReplicatedTable
SetPrimaryKey устанавливает PRIMARY KEY
func (*ReplicatedTable) SetReplicaName ¶
func (rt *ReplicatedTable) SetReplicaName(name string) *ReplicatedTable
SetReplicaName устанавливает имя реплики
func (*ReplicatedTable) SetReplicaPath ¶
func (rt *ReplicatedTable) SetReplicaPath(path string) *ReplicatedTable
SetReplicaPath устанавливает путь реплики
func (*ReplicatedTable) SetSampleBy ¶
func (rt *ReplicatedTable) SetSampleBy(expr string) *ReplicatedTable
SetSampleBy устанавливает SAMPLE BY
func (*ReplicatedTable) SetTTL ¶
func (rt *ReplicatedTable) SetTTL(expr string) *ReplicatedTable
SetTTL устанавливает TTL
func (*ReplicatedTable) SetZooKeeperPath ¶
func (rt *ReplicatedTable) SetZooKeeperPath(path string) *ReplicatedTable
SetZooKeeperPath устанавливает путь в ZooKeeper
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row представляет строку результата
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema представляет схему базы данных
func (*Schema) CreateDatabase ¶
CreateDatabase создает базу данных
func (*Schema) CreateIndex ¶
func (s *Schema) CreateIndex(ctx context.Context, indexName, tableName string, columns []string) error
CreateIndex создает индекс
func (*Schema) CreateMaterializedView ¶
func (s *Schema) CreateMaterializedView(ctx context.Context, viewName, tableName, selectQuery string) error
CreateMaterializedView создает материализованное представление
func (*Schema) CreateTable ¶
func (s *Schema) CreateTable(ctx context.Context, tableName string, columns []string, engine string, options map[string]string) error
CreateTable создает таблицу
func (*Schema) DropColumn ¶
DropColumn удаляет колонку
func (*Schema) DropDatabase ¶
DropDatabase удаляет базу данных
func (*Schema) DropMaterializedView ¶
DropMaterializedView удаляет материализованное представление
func (*Schema) GetDatabases ¶
GetDatabases получает список баз данных
func (*Schema) GetTableInfo ¶
func (s *Schema) GetTableInfo(ctx context.Context, tableName string) (map[string]interface{}, error)
GetTableInfo получает информацию о таблице
func (*Schema) ModifyColumn ¶
ModifyColumn изменяет тип колонки
func (*Schema) RenameColumn ¶
RenameColumn переименовывает колонку
func (*Schema) RenameTable ¶
RenameTable переименовывает таблицу
type ShardManager ¶
type ShardManager struct {
// contains filtered or unexported fields
}
ShardManager представляет менеджер шардов
func NewShardManager ¶
func NewShardManager(cluster *Cluster) *ShardManager
NewShardManager создает новый менеджер шардов
func (*ShardManager) BalanceLoad ¶
func (sm *ShardManager) BalanceLoad(ctx context.Context) error
BalanceLoad балансирует нагрузку между шардами
func (*ShardManager) GetShardInfo ¶
func (sm *ShardManager) GetShardInfo(ctx context.Context) (map[string]interface{}, error)
GetShardInfo получает информацию о шардах
func (*ShardManager) GetShardNodes ¶
func (sm *ShardManager) GetShardNodes(ctx context.Context, clusterName string) ([]map[string]interface{}, error)
GetShardNodes получает узлы шарда
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx представляет транзакцию
type User ¶
type User struct {
ID uint32 `ch:"id" ch_type:"UInt32" ch_pk:"true"`
Name string `ch:"name" ch_type:"String"`
Email string `ch:"email" ch_type:"String"`
Age uint8 `ch:"age" ch_type:"UInt8"`
Created time.Time `ch:"created" ch_type:"DateTime"`
Updated time.Time `ch:"updated" ch_type:"DateTime"`
IsActive bool `ch:"is_active" ch_type:"Boolean"`
Score float64 `ch:"score" ch_type:"Float64"`
}
User представляет пользователя
type UserStats ¶
type UserStats struct {
UserID uint32 `ch:"user_id" ch_type:"UInt32"`
TotalOrders uint32 `ch:"total_orders" ch_type:"UInt32"`
TotalSpent float64 `ch:"total_spent" ch_type:"Float64"`
AvgOrderSize float64 `ch:"avg_order_size" ch_type:"Float64"`
LastOrder string `ch:"last_order" ch_type:"String"`
}
UserStats представляет статистику пользователей
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window представляет оконную функцию
func (*Window) AddToQuery ¶
AddToQuery добавляет оконную функцию к запросу
func (*Window) FirstValue ¶
FirstValue добавляет FIRST_VALUE()
func (*Window) PercentRank ¶
PercentRank добавляет PERCENT_RANK()