Skip to content

Commit

Permalink
Add GetClient method to all implementations
Browse files Browse the repository at this point in the history
this will allow users to amend few settings after c-tor

Fixes #184

Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
  • Loading branch information
glimchb committed Feb 29, 2024
1 parent 0a05f2e commit cdf3549
Show file tree
Hide file tree
Showing 23 changed files with 111 additions and 1 deletion.
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

0 comments on commit cdf3549

Please sign in to comment.