cherryMongo

package module
v1.3.21 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

mongo组件

  • 基于mongodb实现多数据实例管理

Install

Prerequisites
  • GO >= 1.18
Using go get
go get github.com/cherry-game/cherry/components/mongo@latest

Quick Start

import cherryMongo "github.com/cherry-game/cherry/components/mongo"

example

  • 示例代码待补充

Documentation

Index

Constants

View Source
const (
	Name = "mongo_component"
)

Variables

This section is empty.

Functions

func CreateDatabase

func CreateDatabase(uri, dbName string, timeout ...time.Duration) (*mongo.Database, error)

Types

type Component

type Component struct {
	cfacade.Component
	// contains filtered or unexported fields
}

func NewComponent

func NewComponent() *Component

func (*Component) GetDb

func (s *Component) GetDb(id string) *mongo.Database

func (*Component) GetDbMap

func (s *Component) GetDbMap(groupID string) (map[string]*mongo.Database, bool)

func (*Component) GetHashDb

func (s *Component) GetHashDb(groupID string, hashFn HashDb) (*mongo.Database, bool)

func (*Component) Init

func (s *Component) Init()

func (*Component) Name

func (*Component) Name() string

type HashDb

type HashDb func(dbMaps map[string]*mongo.Database) string

HashDb hash by group id

Jump to

Keyboard shortcuts

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