internal

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(m *Manager)

Types

type Collection

type Collection struct {
	Database *Database
	*mongo.Collection
}

type Config

type Config struct {
	Global    map[string]*DatabaseConfig
	Platforms map[string]map[string]*DatabaseConfig
}

type Database

type Database struct {
	*DatabaseConfig
	Client     *mongo.Client
	Database   *mongo.Database
	Collection sync.Map
}

func (*Database) Connect

func (d *Database) Connect() error

func (*Database) GetCollection

func (d *Database) GetCollection(name string) (*Collection, error)

type DatabaseConfig

type DatabaseConfig struct {
	HostName string // 主机地址
	HostPort int32  // 端口
	Database string // 数据库名
	Username string // 用户名
	Password string // 密码
	Options  string // 配置
}

type Manager

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

func NewManager

func NewManager(conf *Config) *Manager

func (*Manager) GetCollection

func (m *Manager) GetCollection(key, database, collection string) (*Collection, error)

func (*Manager) GetConfig

func (m *Manager) GetConfig() *Config

func (*Manager) GetDatabase

func (m *Manager) GetDatabase(key, database string) (*Database, error)

func (*Manager) Restart

func (m *Manager) Restart(conf *Config)

Jump to

Keyboard shortcuts

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