infrastructure

package
v0.0.0-...-4f702ff Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBCluster

type DBCluster struct {
	Capacity    uint
	EntityTypes []string
	Items       []minipkg_gorm.IDB
}

func (*DBCluster) ApplyFunc2DBs

func (s *DBCluster) ApplyFunc2DBs(f func(db minipkg_gorm.IDB) error) (err error)

func (*DBCluster) Close

func (s *DBCluster) Close() (err error)

func (*DBCluster) SchemesInitWithContext

func (s *DBCluster) SchemesInitWithContext(ctx context.Context, model interface{}) (err error)

type Infrastructure

type Infrastructure struct {
	Logger       log.Logger
	DataSharding Sharding
	ReferenceDB  minipkg_gorm.IDB
	//SearchDB     minipkg_gorm.IDB
	Redis redis.IDB
}

func NewInfrastructure

func NewInfrastructure(ctx context.Context, logger log.Logger, cfg *config.Infrastructure, model2sharding interface{}) (*Infrastructure, error)

func (*Infrastructure) Stop

func (i *Infrastructure) Stop() error

type Sharding

type Sharding struct {
	IsAutoMigrate                bool
	Model                        interface{}
	Default                      *DBCluster
	BySysnames                   map[string]*DBCluster
	ClusterSysnamesByEntityTypes map[string]string
}

func (*Sharding) ApplyFunc2DBs

func (s *Sharding) ApplyFunc2DBs(f func(db minipkg_gorm.IDB) error) (err error)

func (*Sharding) Close

func (s *Sharding) Close() (err error)

func (*Sharding) GetClustersByEntityTypes

func (s *Sharding) GetClustersByEntityTypes(entityTypes []string) ([]*DBCluster, error)

func (*Sharding) SchemesInitWithContext

func (s *Sharding) SchemesInitWithContext(ctx context.Context, model interface{}) (err error)

Jump to

Keyboard shortcuts

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