add del func of redis string type
This commit is contained in:
parent
3fa0a8c6ca
commit
f8f83c38d9
|
|
@ -95,3 +95,20 @@ func (rs *RedisString) IncrBy(stringKey string, value int64) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GETDEL define func of get the value of key and delete the key
|
||||
func (rs *RedisString) GETDEL(stringKey string) error {
|
||||
err := rs.rwLocker.WLock(rs.ctx)
|
||||
if err != nil {
|
||||
logger.Error(rs.ctx, "lock wLock by stringKey failed", "string_key", stringKey, "error", err)
|
||||
return err
|
||||
}
|
||||
defer rs.rwLocker.UnWLock(rs.ctx)
|
||||
|
||||
err = rs.storageClient.GetDel(rs.ctx, stringKey).Err()
|
||||
if err != nil {
|
||||
logger.Error(rs.ctx, "del the key failed", "string_key", stringKey, "error", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -1,6 +1,6 @@
|
|||
module modelRT
|
||||
|
||||
go 1.22.5
|
||||
go 1.24.1
|
||||
|
||||
require (
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.2
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// Package network define struct of network operation
|
||||
package network
|
||||
|
||||
import (
|
||||
|
|
@ -6,6 +7,7 @@ import (
|
|||
"modelRT/orm"
|
||||
)
|
||||
|
||||
// ConvertAnyComponentInfosToComponents define convert any component request info to component struct
|
||||
func ConvertAnyComponentInfosToComponents(anyInfo interface{}) (*orm.Component, error) {
|
||||
switch info := anyInfo.(type) {
|
||||
case ComponentCreateInfo:
|
||||
Loading…
Reference in New Issue