store

package
v0.0.0-...-044e210 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoStore

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

MongoStore 基于Mongo的存储

func NewMongoStore

func NewMongoStore(address, db, collection string) (*MongoStore, error)

NewMongoStore 构建一个MongoStore 参数: * address string mongo服务器地址 mongodb://用户名:密码@ip:端口/验证服务器 * db string 数据库名 * collection string 表名 返回值: * *MongoStore *MongoStore * error error

func (*MongoStore) Get

func (m *MongoStore) Get(key string, version int) (data string, cfgType model.CfgType, err error)

Get 获取配置 参数: * key string key * version int 版本,0表示最新版本 返回值: * data string 配置数据 * cfgType model.CfgType 配置类型 * err error

func (*MongoStore) Init

func (m *MongoStore) Init() error

func (*MongoStore) Write

func (m *MongoStore) Write(key string, data string, cfgType model.CfgType) error

type Store

type Store interface {
	Write(key string, data string, cfgType model.CfgType) error
	Get(key string, version int) (data string, cfgType model.CfgType, err error)
}

type VersionInfo

type VersionInfo struct {
	Id      string `bson:"_id"`     //key
	Version int    `bson:"version"` //最新版本
}

VersionInfo 版本信息

Jump to

Keyboard shortcuts

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