Documentation ¶
Index ¶
- Variables
- func BindWatcher(key string, wFunc EtcdHandler, args ...interface{}) error
- func BindWatcherPrefix(key string, isPrefix bool, wFunc EtcdHandler, args ...interface{}) error
- func Close()
- func Delete(key string, prefix bool) error
- func Dial(urls []string) error
- func DialTimeout(urls []string, timeout time.Duration) error
- func Grent(ttl int64) (resp *clientv3.LeaseGrantResponse, err error)
- func Keeplive(Id clientv3.LeaseID) (<-chan *clientv3.LeaseKeepAliveResponse, error)
- func KeepliveOnce(Id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error)
- func MarshalKey(key string, val interface{}) error
- func MarshalKeyTTL(key string, val interface{}, ttl int64) (Id clientv3.LeaseID, err error)
- func Read(key string) (body []byte, err error)
- func ReadAll(key string) (body *clientv3.GetResponse, err error)
- func Revoke(Id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)
- func SetFormatter(in Formatter)
- func StopWatcher(key string) error
- func TimeToLive(Id clientv3.LeaseID) (resp *clientv3.LeaseTimeToLiveResponse, err error)
- func UnmarshalKey(key string, val interface{}) error
- func Write(key string, val []byte) error
- func WriteGrent(key string, val []byte, Id clientv3.LeaseID) error
- func WriteTTL(key string, val []byte, ttl int64) (Id clientv3.LeaseID, err error)
- type BsonFormatter
- type EtcdHandler
- type EtcdWatcher
- type Formatter
- type JsonFormatter
- type M
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BindWatcher ¶
func BindWatcher(key string, wFunc EtcdHandler, args ...interface{}) error
///////////////////////////////////////////////////////////// watcher watcher函数第一个参数必须是string,会自动传入type,否则无法绑定 watcher函数第二个参数必须是[]byte,会自动传入key,否则无法绑定 watcher函数第三个个参数必须是[]byte,会自动传入value,否则无法绑定 watcher example:func TestCallback(type string,value []byte,testInt int,testFloat float32)
func BindWatcherPrefix ¶
func BindWatcherPrefix(key string, isPrefix bool, wFunc EtcdHandler, args ...interface{}) error
func Keeplive ¶
func Keeplive(Id clientv3.LeaseID) (<-chan *clientv3.LeaseKeepAliveResponse, error)
持续续约 会开启一个持续的携程去续约这个租约
func KeepliveOnce ¶
func KeepliveOnce(Id clientv3.LeaseID) (*clientv3.LeaseKeepAliveResponse, error)
续约一次 本次只续约一次,过后依旧会删除
func MarshalKey ¶
func MarshalKeyTTL ¶
func SetFormatter ¶
func SetFormatter(in Formatter)
func StopWatcher ¶
func TimeToLive ¶
func TimeToLive(Id clientv3.LeaseID) (resp *clientv3.LeaseTimeToLiveResponse, err error)
func UnmarshalKey ¶
Types ¶
type BsonFormatter ¶
type BsonFormatter struct { }
//////////////////////////////////////////////// bson的格式化
func (*BsonFormatter) FromString ¶
func (f *BsonFormatter) FromString(convert string) []byte
func (*BsonFormatter) Marshal ¶
func (f *BsonFormatter) Marshal(v interface{}) ([]byte, error)
func (*BsonFormatter) ToString ¶
func (f *BsonFormatter) ToString(convert []byte) string
func (*BsonFormatter) Unmarshal ¶
func (f *BsonFormatter) Unmarshal(data []byte, v interface{}) error
type EtcdHandler ¶
type EtcdHandler interface{}
type EtcdWatcher ¶
type EtcdWatcher struct {
// contains filtered or unexported fields
}
func (*EtcdWatcher) Close ¶
func (w *EtcdWatcher) Close()
type Formatter ¶
type Formatter interface { Marshal(v interface{}) ([]byte, error) Unmarshal(data []byte, v interface{}) error ToString(convert []byte) string FromString(convert string) []byte }
格式化CallBack
type JsonFormatter ¶
type JsonFormatter struct { }
内建支持json和base64等 //////////////////////////////////////////////// json格式化
func (*JsonFormatter) FromString ¶
func (f *JsonFormatter) FromString(convert string) []byte
func (*JsonFormatter) Marshal ¶
func (f *JsonFormatter) Marshal(v interface{}) ([]byte, error)
func (*JsonFormatter) ToString ¶
func (f *JsonFormatter) ToString(convert []byte) string
func (*JsonFormatter) Unmarshal ¶
func (f *JsonFormatter) Unmarshal(data []byte, v interface{}) error
Click to show internal directories.
Click to hide internal directories.