kv

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgFindKvFailed      = "find kv failed, deadline exceeded"
	MsgFindOneKey        = "find one key"
	MsgCreateLabelFailed = "create label failed"
	FmtErrFindKvFailed   = "can not find kv in %s"
)

const of kv service

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service operate data in mongodb

func (*Service) Create

func (s *Service) Create(ctx context.Context, kv *model.KVDoc) (*model.KVDoc, error)

Create will create a key value record

func (*Service) Exist

func (s *Service) Exist(ctx context.Context, domain, key string, project string, options ...service.FindOption) (*model.KVDoc, error)

Exist supports you query a key value by label map or labels id

func (*Service) FindManyAndDelete

func (s *Service) FindManyAndDelete(ctx context.Context, kvIDs []string, domain string, project string) ([]*model.KVDoc, error)

FindManyAndDelete deletes multiple kvs and return the deleted kv list as these appeared before deletion

func (*Service) FindOneAndDelete

func (s *Service) FindOneAndDelete(ctx context.Context, kvID string, domain string, project string) (*model.KVDoc, error)

FindOneAndDelete deletes one kv by id and return the deleted kv as these appeared before deletion domain=tenant

func (*Service) Get

func (s *Service) Get(ctx context.Context, request *model.GetKVRequest) (*model.KVDoc, error)

Get get kvs by id

func (*Service) List

func (s *Service) List(ctx context.Context, domain, project string, options ...service.FindOption) (*model.KVResponse, error)

List get kv list by key and criteria

func (*Service) Total

func (s *Service) Total(ctx context.Context, domain string) (int64, error)

Total return kv record number

func (*Service) Update

func (s *Service) Update(ctx context.Context, kv *model.UpdateKVRequest) (*model.KVDoc, error)

Update will update a key value record

Jump to

Keyboard shortcuts

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