Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetClient method to all implementations #185

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions badgerdb/badgerdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ type Store struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (s Store) GetStore() *badger.DB {
return s.db
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions bbolt/bbolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ type Store struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (s Store) GetStore() *bolt.DB {
return s.db
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions bigcache/bigcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ type Store struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (s Store) GetStore() *bigcache.BigCache {
return s.s
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *api.KV {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions datastore/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *datastore.Client {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
2 changes: 1 addition & 1 deletion docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Package gokv contains a simple key-value store abstraction in the form of a Go interface.
Implementations of the gokv.Store interface can be found in the sub-packages.

Usage
# Usage

Example code for using Redis:

Expand Down
5 changes: 5 additions & 0 deletions dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *awsdynamodb.DynamoDB {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *clientv3.Client {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions freecache/freecache.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ type Store struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (s Store) GetStore() *freecache.Cache {
return s.s
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions gomap/gomap.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ type Store struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (s Store) GetStore() map[string][]byte {
return s.m
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions hazelcast/hazelcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *hazelcast.Client {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions ignite/ignite.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() ignite.Client {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions leveldb/leveldb.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ type Store struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (s Store) GetStore() *leveldb.DB {
return s.db
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions memcached/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *memcache.Client {
return c.c
}

// Set stores the given value for the given key.
// The key must not be longer than 250 bytes (this is a restriction of Memcached).
// Values are automatically marshalled to JSON or gob (depending on the configuration).
Expand Down
5 changes: 5 additions & 0 deletions mongodb/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ type Client struct {
cancel context.CancelFunc
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *mongo.Collection {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ type Client struct {
c *sql.Client
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *sql.Client {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The length of the key must not exceed 255 characters.
Expand Down
5 changes: 5 additions & 0 deletions redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *redis.Client {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *awss3.S3 {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ type Client struct {
Codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *sql.DB {
return c.C
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions syncmap/syncmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ type Store struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (s Store) GetStore() *sync.Map {
return s.m
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions tablestorage/tablestorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *storage.Table {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions tablestore/tablestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *tablestore.TableStoreClient {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
5 changes: 5 additions & 0 deletions zookeeper/zookeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ type Client struct {
codec encoding.Codec
}

// Gets underlying store to allow user manipulate object directly.
func (c Client) GetStore() *zk.Conn {
return c.c
}

// Set stores the given value for the given key.
// Values are automatically marshalled to JSON or gob (depending on the configuration).
// The key must not be "" and the value must not be nil.
Expand Down
Loading