db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package db manage db connection

Index

Constants

View Source
const (
	Name                    = "kie"
	CollectionLabel         = "label"
	CollectionKV            = "kv"
	CollectionLabelRevision = "label_revision"

	DefaultTimeout   = 5 * time.Second
	DefaultValueType = "text"
)

const for db name and collection name

Variables

View Source
var (
	ErrMissingDomain          = errors.New("domain info missing, illegal access")
	ErrMissingProject         = errors.New("project info missing, illegal access")
	ErrKeyNotExists           = errors.New("key with labels does not exits")
	ErrLabelNotExists         = errors.New("labels does not exits")
	ErrTooMany                = errors.New("key with labels should be only one")
	ErrKeyMustNotEmpty        = errors.New("must supply key if you want to get exact one result")
	ErrRevisionNotExist       = errors.New("label revision not exist")
	ErrKVIDIsNil              = errors.New("kvID id is nil")
	ErrKvIDAndLabelIDNotMatch = errors.New("kvID and labelID do not match")
	ErrRootCAMissing          = errors.New("rootCAFile is empty in config file")
)

db errors

View Source
var Timeout time.Duration

Timeout db operation time out

Functions

func GetClient

func GetClient() (*mongo.Client, error)

GetClient create a new mongo db client if client is created, just return.

func Init

func Init() error

Init prepare params

Types

This section is empty.

Jump to

Keyboard shortcuts

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