mongodb

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinPool        = 10
	DefaultMaxPool = 100
	AllowMaxPool   = 250
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BranchImpl

type BranchImpl struct {
}

func (BranchImpl) CreateBatches

func (b BranchImpl) CreateBatches(ctx context.Context, list entity.BranchList) error

func (BranchImpl) GetBranches

func (b BranchImpl) GetBranches(ctx context.Context, gid string) (list entity.BranchList, err error)

func (BranchImpl) GetCollection

func (b BranchImpl) GetCollection() *mongo.Collection

func (BranchImpl) UpdateBranchStateByGid

func (b BranchImpl) UpdateBranchStateByGid(ctx context.Context, branchId string, state consts.BranchState, errMsg string) (int64, error)

type Dao

type Dao struct {
	dao.BranchDao
	dao.GlobalDao
}

func NewDao

func NewDao(client *mongo.Client, databaseName string) Dao

type GlobalImpl

type GlobalImpl struct {
}

func (GlobalImpl) CreateGlobal

func (g GlobalImpl) CreateGlobal(ctx context.Context, global *entity.Global) (err error)

func (GlobalImpl) FindProcessingList

func (g GlobalImpl) FindProcessingList(ctx context.Context, limit, maxTimes int) (list []*entity.Global, err error)

func (GlobalImpl) GetCollection

func (g GlobalImpl) GetCollection() *mongo.Collection

func (GlobalImpl) GetGlobal

func (g GlobalImpl) GetGlobal(ctx context.Context, gid string) (global entity.Global, err error)

func (GlobalImpl) IncrTryTimes

func (g GlobalImpl) IncrTryTimes(ctx context.Context, gid string, nextCronTime int) error

func (GlobalImpl) UpdateGlobalStateByGid

func (g GlobalImpl) UpdateGlobalStateByGid(ctx context.Context, gid string,
	state consts.GlobalState) (int64, error)

type Settings

type Settings struct {
	Uri     string `yaml:"url"` // example: mongodb://localhost:27017
	MinPool int    `yaml:"minPool"`
	MaxPool int    `yaml:"maxPool"`
}

func (*Settings) Init

func (settings *Settings) Init()

Jump to

Keyboard shortcuts

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