consul

package
v0.0.0-...-7c3836c Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConsulGet      = errors.New("获取consul信息失败")
	ErrConsulConnect  = errors.New("consul链接失败")
	ErrConsulDelete   = errors.New("consul删除失败")
	ErrConsulExist    = errors.New("已存在同名consul")
	ErrConsulCreate   = errors.New("consul创建失败")
	ErrConsulUpdate   = errors.New("consul更新失败")
	ErrConsulNotExist = errors.New("consul不存在")
	ErrConsulKVGet    = errors.New("KV信息获取失败")
	ErrConsulKVParams = errors.New("参数错误")
	ErrConsulKVPost   = errors.New("KV创建失败")
	ErrConsulKVDelete = errors.New("KV删除失败")
)
View Source
var (
	ErrConsulVisit = errors.New("抱歉,您未开启consul模块,请在app.cfg把consul_kv设置为true")
)

Functions

func MakeHandler

func MakeHandler(svc Service, logger log.Logger, cf *config.Config) http.Handler

Types

type Service

type Service interface {
	// ACL信息同步到DB
	Sync(ctx context.Context) (err error)

	// 获取ACL详情
	Detail(ctx context.Context, ns, name string) (res map[string]interface{}, err error)

	// 获取ACL列表
	List(ctx context.Context, ns, name string, page, limit int) (res map[string]interface{}, err error)

	// 创建ACL
	Post(ctx context.Context, ns, name, clientType, rules string) error

	// 更新ACL
	Update(ctx context.Context, ns, name, clientType, rules string) error

	// 删除ACL
	Delete(ctx context.Context, ns, name string) error

	// 获取KV详情
	KVDetail(ctx context.Context, ns, name, prefix string) (res map[string]interface{}, err error)

	// 获取KV目录列表
	KVList(ctx context.Context, ns, name, prefix string) (res map[string]interface{}, err error)

	// 获取KV
	KVPost(ctx context.Context, ns, name, key, value string) (err error)

	// 删除KV或目录
	KVDelete(ctx context.Context, ns, name, prefix string, filderState bool) (err error)
}

func NewLoggingService

func NewLoggingService(logger log.Logger, s Service) Service

func NewService

func NewService(logger log.Logger, cf *config.Config, store repository.Repository) Service

Jump to

Keyboard shortcuts

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