cluster

package
v0.6.12 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COUMT_IS_EMPTY   = -1 // 尚未计数
	COUMT_IS_DYNAMIC = -2 // 不缓存计数
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Sharding

type Sharding struct {
	IsTableNameDesc bool
	DbNameMatch     string
	TableFilter     func(dbname, table string) bool
	*gorm.DB
	// contains filtered or unexported fields
}

func NewSharding

func NewSharding(db *gorm.DB, desc bool) *Sharding

func (*Sharding) CountSharding

func (s *Sharding) CountSharding(model ShardingModel) (count int64)

Count all

func (*Sharding) Create

func (s *Sharding) Create(value ShardingModel) *Sharding

Create insert the value into database

func (*Sharding) FirstTable

func (s *Sharding) FirstTable(out ShardingModel, isLast bool) (tableName string)

func (*Sharding) PaginateSharding

func (s *Sharding) PaginateSharding(model ShardingModel, page, size int, fetch base.FilterFunc) error

Select step by step.

type ShardingModel

type ShardingModel interface {
	BaseTableName() string
	TableName() string
}

Jump to

Keyboard shortcuts

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