clickhousex

package module
v0.0.0-...-07fd573 Latest Latest
Warning

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

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

README

clickhousex

clickhouse 数据操作

Documentation

Overview

Package clickhousex Date: 2023/12/7 10:33 Author: Amu Description:

Package clickhousex Date: 2023/12/7 10:30 Author: Amu Description:

Package clickhousex Date: 2023/12/6 18:28 Author: Amu Description:

Package clickhousex Date: 2023/12/6 18:08 Author: Amu Description:

Package clickhousex Date: 2023/12/6 18:08 Author: Amu Description:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchOption

type BatchOption func(*batchOption)

func WithBatchInterval

func WithBatchInterval(interval int) BatchOption

func WithBatchSize

func WithBatchSize(size int) BatchOption

func WithDB

func WithDB(db *DB) BatchOption

func WithModel

func WithModel(model interface{}) BatchOption

type BatchProcessor

type BatchProcessor struct {
	// contains filtered or unexported fields
}

func NewBatchProcessor

func NewBatchProcessor(opts ...BatchOption) *BatchProcessor

func (*BatchProcessor) Add

func (b *BatchProcessor) Add(item map[string]interface{}) error

func (*BatchProcessor) Start

func (b *BatchProcessor) Start()

func (*BatchProcessor) Stop

func (b *BatchProcessor) Stop()

type DB

type DB struct {
	*gorm.DB
}

func NewDB

func NewDB(opts ...Option) (*DB, error)

func (*DB) AutoMigrate

func (db *DB) AutoMigrate(models ...interface{}) error

func (*DB) Close

func (db *DB) Close()

func (*DB) RunInTransaction

func (db *DB) RunInTransaction(fn func(tx *gorm.DB) error) error

type Option

type Option func(*option)

func WithAddr

func WithAddr(addr string) Option

func WithConnMaxLifeTime

func WithConnMaxLifeTime(lifeTime int) Option

func WithDatabase

func WithDatabase(dbName string) Option

func WithDebug

func WithDebug(debug bool) Option

func WithDialTimeout

func WithDialTimeout(dialTimeout int) Option

func WithMaxIdleConns

func WithMaxIdleConns(maxIdle int) Option

func WithMaxOpenConns

func WithMaxOpenConns(maxOpen int) Option

func WithPassword

func WithPassword(password string) Option

func WithUsername

func WithUsername(username string) Option

type User

type User struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Age      int64  `json:"age"`
	Sex      int64  `json:"sex"`
}

Jump to

Keyboard shortcuts

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