Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrorCodeKeyConflict = 409 ErrorCodeKeyNotFound = 404 )
Variables ¶
This section is empty.
Functions ¶
func IsKeyConflict ¶
IsKeyConflict returns true if the error code is ErrorCodeKeyConflict.
func IsKeyNotFound ¶
IsKeyNotFound returns true if the error code is ErrorCodeKeyNotFound.
Types ¶
type DAO ¶
type DAO interface {
io.Closer
Create(key string, entity interface{}) error
Upsert(key string, entity interface{}) error
Get(key string, entity interface{}) error
Query(query Query, slice interface{}) error
Delete(key string) error
Watch(ctx context.Context, query Query) (clientv3.WatchChan, error)
RequestLocker() KeyLocker
}
DAO defines CRUD method
type KeyLocker ¶
type KeyLocker interface {
// Lock is creating a lock for the given key
Lock(key string) error
// Unlock is removing the lock for the given key
Unlock(key string)
}
KeyLocker is the interface that will provide methods to lock and unlock for a specific key Recommended usage : ```
err := k.Lock(key)
defer k.Unlock(key)
if err != nil {
// do something with the error
}
```
Click to show internal directories.
Click to hide internal directories.