Skip to content

Commit 24b7d1e

Browse files
committed
feat: add username parameter to store initialization functions
- Update the `NewStore` function to include a `username` parameter. - Modify the `NewStoreWithDB` function to also include a `username` parameter. - Adjust the test case to reflect the changes in the `NewStore` function signature. Signed-off-by: appleboy <appleboy.tw@gmail.com>
1 parent 6705bb2 commit 24b7d1e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

redis/redis.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ type Store interface {
2626
//
2727
// It is recommended to use an authentication key with 32 or 64 bytes. The encryption key,
2828
// if set, must be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256 modes.
29-
func NewStore(size int, network, address, password string, keyPairs ...[]byte) (Store, error) {
30-
s, err := redistore.NewRediStore(size, network, address, password, keyPairs...)
29+
func NewStore(size int, network, address, username, password string, keyPairs ...[]byte) (Store, error) {
30+
s, err := redistore.NewRediStore(size, network, address, username, password, keyPairs...)
3131
if err != nil {
3232
return nil, err
3333
}
@@ -47,8 +47,8 @@ func NewStore(size int, network, address, password string, keyPairs ...[]byte) (
4747
// Returns:
4848
// - Store: The created session store.
4949
// - error: An error if the store could not be created.
50-
func NewStoreWithDB(size int, network, address, password, DB string, keyPairs ...[]byte) (Store, error) {
51-
s, err := redistore.NewRediStoreWithDB(size, network, address, password, DB, keyPairs...)
50+
func NewStoreWithDB(size int, network, address, username, password, DB string, keyPairs ...[]byte) (Store, error) {
51+
s, err := redistore.NewRediStoreWithDB(size, network, address, username, password, DB, keyPairs...)
5252
if err != nil {
5353
return nil, err
5454
}

redis/redis_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
const redisTestServer = "localhost:6379"
1111

1212
var newRedisStore = func(_ *testing.T) sessions.Store {
13-
store, err := NewStore(10, "tcp", redisTestServer, "", []byte("secret"))
13+
store, err := NewStore(10, "tcp", redisTestServer, "", "", []byte("secret"))
1414
if err != nil {
1515
panic(err)
1616
}

0 commit comments

Comments
 (0)