1
0
mirror of https://github.com/kataras/iris.git synced 2026-05-01 11:45:28 +00:00

update dependencies

This commit is contained in:
Gerasimos (Makis) Maropoulos
2025-08-15 23:29:20 +03:00
parent de4f462198
commit a8a3afea22
186 changed files with 694 additions and 689 deletions

View File

@@ -127,7 +127,7 @@ func makeKey(sid, key string) []byte {
// Set sets a key value of a specific session.
// Ignore the "immutable".
func (db *Database) Set(sid string, key string, value interface{}, ttl time.Duration, immutable bool) error {
func (db *Database) Set(sid string, key string, value any, ttl time.Duration, immutable bool) error {
valueBytes, err := sessions.DefaultTranscoder.Marshal(value)
if err != nil {
db.logger.Error(err)
@@ -146,7 +146,7 @@ func (db *Database) Set(sid string, key string, value interface{}, ttl time.Dura
}
// Get retrieves a session value based on the key.
func (db *Database) Get(sid string, key string) (value interface{}) {
func (db *Database) Get(sid string, key string) (value any) {
if err := db.Decode(sid, key, &value); err == nil {
return value
}
@@ -155,7 +155,7 @@ func (db *Database) Get(sid string, key string) (value interface{}) {
}
// Decode binds the "outPtr" to the value associated to the provided "key".
func (db *Database) Decode(sid, key string, outPtr interface{}) error {
func (db *Database) Decode(sid, key string, outPtr any) error {
err := db.Service.View(func(txn *badger.Txn) error {
item, err := txn.Get(makeKey(sid, key))
if err != nil {
@@ -181,7 +181,7 @@ func validSessionItem(key, prefix []byte) bool {
}
// Visit loops through all session keys and values.
func (db *Database) Visit(sid string, cb func(key string, value interface{})) error {
func (db *Database) Visit(sid string, cb func(key string, value any)) error {
prefix := makePrefix(sid)
txn := db.Service.NewTransaction(false)
@@ -201,7 +201,7 @@ func (db *Database) Visit(sid string, cb func(key string, value interface{})) er
continue
}
var value interface{}
var value any
err := item.Value(func(valueBytes []byte) error {
return sessions.DefaultTranscoder.Unmarshal(valueBytes, &value)

View File

@@ -254,7 +254,7 @@ func makeKey(key string) []byte {
// Set sets a key value of a specific session.
// Ignore the "immutable".
func (db *Database) Set(sid string, key string, value interface{}, ttl time.Duration, immutable bool) error {
func (db *Database) Set(sid string, key string, value any, ttl time.Duration, immutable bool) error {
valueBytes, err := sessions.DefaultTranscoder.Marshal(value)
if err != nil {
db.logger.Debug(err)
@@ -282,7 +282,7 @@ func (db *Database) Set(sid string, key string, value interface{}, ttl time.Dura
}
// Get retrieves a session value based on the key.
func (db *Database) Get(sid string, key string) (value interface{}) {
func (db *Database) Get(sid string, key string) (value any) {
if err := db.Decode(sid, key, &value); err == nil {
return value
}
@@ -291,7 +291,7 @@ func (db *Database) Get(sid string, key string) (value interface{}) {
}
// Decode binds the "outPtr" to the value associated to the provided "key".
func (db *Database) Decode(sid, key string, outPtr interface{}) error {
func (db *Database) Decode(sid, key string, outPtr any) error {
err := db.Service.View(func(tx *bolt.Tx) error {
b := db.getBucketForSession(tx, sid)
if b == nil {
@@ -313,7 +313,7 @@ func (db *Database) Decode(sid, key string, outPtr interface{}) error {
}
// Visit loops through all session keys and values.
func (db *Database) Visit(sid string, cb func(key string, value interface{})) error {
func (db *Database) Visit(sid string, cb func(key string, value any)) error {
err := db.Service.View(func(tx *bolt.Tx) error {
b := db.getBucketForSession(tx, sid)
if b == nil {
@@ -321,7 +321,7 @@ func (db *Database) Visit(sid string, cb func(key string, value interface{})) er
}
return b.ForEach(func(k []byte, v []byte) error {
var value interface{}
var value any
if err := sessions.DefaultTranscoder.Unmarshal(v, &value); err != nil {
db.logger.Debugf("unable to retrieve value of key '%s' of '%s': %v", k, sid, err)
return err

View File

@@ -165,7 +165,7 @@ func (db *Database) OnUpdateExpiration(sid string, newExpires time.Duration) err
// Set sets a key value of a specific session.
// Ignore the "immutable".
func (db *Database) Set(sid string, key string, value interface{}, _ time.Duration, _ bool) error {
func (db *Database) Set(sid string, key string, value any, _ time.Duration, _ bool) error {
valueBytes, err := sessions.DefaultTranscoder.Marshal(value)
if err != nil {
db.logger.Error(err)
@@ -181,7 +181,7 @@ func (db *Database) Set(sid string, key string, value interface{}, _ time.Durati
}
// Get retrieves a session value based on the key.
func (db *Database) Get(sid string, key string) (value interface{}) {
func (db *Database) Get(sid string, key string) (value any) {
if err := db.Decode(sid, key, &value); err == nil {
return value
}
@@ -190,7 +190,7 @@ func (db *Database) Get(sid string, key string) (value interface{}) {
}
// Decode binds the "outPtr" to the value associated to the provided "key".
func (db *Database) Decode(sid, key string, outPtr interface{}) error {
func (db *Database) Decode(sid, key string, outPtr any) error {
sidKey := db.makeSID(sid)
data, err := db.c.Driver.Get(sidKey, key)
if err != nil {
@@ -206,7 +206,7 @@ func (db *Database) Decode(sid, key string, outPtr interface{}) error {
return nil
}
func (db *Database) decodeValue(val interface{}, outPtr interface{}) error {
func (db *Database) decodeValue(val any, outPtr any) error {
if val == nil {
return nil
}
@@ -234,14 +234,14 @@ func (db *Database) keys(fullSID string) []string {
}
// Visit loops through all session keys and values.
func (db *Database) Visit(sid string, cb func(key string, value interface{})) error {
func (db *Database) Visit(sid string, cb func(key string, value any)) error {
kv, err := db.c.Driver.GetAll(db.makeSID(sid))
if err != nil {
return err
}
for k, v := range kv {
var value interface{} // new value each time, we don't know what user will do in "cb".
var value any // new value each time, we don't know what user will do in "cb".
if err = db.decodeValue(v, &value); err != nil {
db.logger.Debugf("unable to decode %s:%s: %v", sid, k, err)
return err

View File

@@ -8,8 +8,8 @@ type Driver interface {
Connect(c Config) error
PingPong() (bool, error)
CloseConnection() error
Set(sid, key string, value interface{}) error
Get(sid, key string) (interface{}, error)
Set(sid, key string, value any) error
Get(sid, key string) (any, error)
Exists(sid string) bool
TTL(sid string) time.Duration
UpdateTTL(sid string, newLifetime time.Duration) error

View File

@@ -150,12 +150,12 @@ func (r *GoRedisDriver) CloseConnection() error {
// Set stores a "value" based on the session's "key".
// The value should be type of []byte, so unmarshal can happen.
func (r *GoRedisDriver) Set(sid, key string, value interface{}) error {
func (r *GoRedisDriver) Set(sid, key string, value any) error {
return r.Client.HSet(defaultContext, sid, key, value).Err()
}
// Get returns the associated value of the session's given "key".
func (r *GoRedisDriver) Get(sid, key string) (interface{}, error) {
func (r *GoRedisDriver) Get(sid, key string) (any, error) {
return r.Client.HGet(defaultContext, sid, key).Bytes()
}