etcd

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

how to import ETCD Plugin

  1. in your main project folder

get lasted go.etcd.io/etcd/client/v3 package

go get go.etcd.io/etcd/client/v3@v3.5.0
go get go.etcd.io/etcd/client/pkg/v3@v3.5.0
  1. Edit your main.go
package main

import (
	_ "github.com/ti/objectbind/etcd"
)

the etcd plugin will be auto registed

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Etcd

type Etcd struct {
	Root string
	// contains filtered or unexported fields
}

Etcd the etcd client

func New

func New(ctx context.Context, uri *url.URL) (*Etcd, error)

New new etcd client

func (*Etcd) Client

func (e *Etcd) Client() *clientv3.Client

Client get the etcd client

func (*Etcd) Close

func (e *Etcd) Close(_ context.Context) error

Close close the etcd

func (*Etcd) Load

func (e *Etcd) Load(ctx context.Context, path string) (map[string][]byte, error)

Load load data from path

func (*Etcd) Save

func (e *Etcd) Save(ctx context.Context, path string, data []byte) (err error)

Save save the data to path

func (*Etcd) Watch

func (e *Etcd) Watch(ctx context.Context, paths []string, onChange func(data map[string][]byte)) error

Watch watch the path

Jump to

Keyboard shortcuts

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