plugger

package
v0.0.0-...-a2093d6 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: LGPL-2.1 Imports: 4 Imported by: 0

README

说明

感觉插件的启动、配置、初始数据的填充都在代码中实现不太好,不仅是有些难以实现,还有就是像这种数据应该是作为容器编排中初始化的步骤才符合应用的运行逻辑

所以这里的所有连接管理都在现有数据的情况下测试数据功能等,不测试自动生成数据的步骤,

账号的生成,权限分配的测试不强求(主要是因为有些不太好实现,可以先占位)

连接器管理

Mysql、Redis、MongoDB、Etcd 等等三方服务的连接器管理

插件的初始化

redis

docker pull redis:6

docker run -d --name redis6 -p 6379:6379 redis --requirepass "123456"

mongodb

除了运行容器外 需要使用 admin 账号进入容器并创建对应的账号信息

docker run -d --name mongo4 -p 27107:27107 mongo:4

docker exec -it  mongo4  mongo admin  // 超级管理员进入

db.createUser({ user: 'admin', pwd: '123456', roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] }); // 创建管理员

db.auth("admin","123456"); // 认证

db.createUser({ user: 'user', pwd: '123456', roles: [ { role: "readWrite", db: "app" } ] }); // 创建密码、用户、数据库

db.auth("user","123456");

use app

db.test.save({name:"zhangsan"});

db.test.find();

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDriver

type IDriver interface {
	Ping() bool              // 连通性测试,
	Initail() error          // 连接状态初始化
	Connection() interface{} // 从连接池中获取管理器 本身存在连接池管理的可以忽略
	Close() error            // 关闭连接
}

type ResourceManager

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

A ResourceManager is a manager that used to manage resources.

func NewResourceManager

func NewResourceManager() *ResourceManager

NewResourceManager returns a ResourceManager.

func (*ResourceManager) Close

func (manager *ResourceManager) Close() error

Close closes the manager. Don't use the ResourceManager after Close() called.

func (*ResourceManager) GetResource

func (manager *ResourceManager) GetResource(key string, create func() (io.Closer, error)) (io.Closer, error)

GetResource returns the resource associated with given key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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