Add Conn() support to all storage drivers. (#451)

* Add DB() support for Redis driver

* Added support for DB() to all drivers

* Fixed typo in README and Lint issue

* Fix lint issue with ristretto db

* Fix lint issue with bbolt db

* Rename DB() to Conn()

* Replace all instances of _DB with _Conn

* Update all the README files

* Return ArangoDB Client instead of DB
This commit is contained in:
Juan Calderon-Perez
2022-08-15 01:58:13 -04:00
committed by GitHub
parent c38c925975
commit 3a8b8d4f71
40 changed files with 138 additions and 8 deletions

View File

@@ -16,6 +16,7 @@ func (s *Storage) Set(key string, val []byte, exp time.Duration) error
func (s *Storage) Delete(key string) error
func (s *Storage) Reset() error
func (s *Storage) Close() error
func (s *Storage) Conn() driver.Client
```
### Installation
ArangoDB is tested on the 2 last (1.14/1.15) [Go versions](https://golang.org/dl/) with support for modules. So make sure to initialize one first if you didn't do that yet:

View File

@@ -246,3 +246,8 @@ func (s *Storage) gc() {
}
}
}
// Return database client
func (s *Storage) Conn() driver.Client {
return s.client
}

View File

@@ -132,3 +132,7 @@ func Test_ARANGODB_Non_UTF8(t *testing.T) {
func Test_ARANGODB_Close(t *testing.T) {
utils.AssertEqual(t, nil, testStore.Close())
}
func Test_ARANGODB_Conn(t *testing.T) {
utils.AssertEqual(t, true, testStore.Conn() != nil)
}