You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
690 B
31 lines
690 B
package dao |
|
|
|
import ( |
|
"context" |
|
"fmt" |
|
|
|
"github.com/pkg/errors" |
|
) |
|
|
|
func assetRelationKey(mid int64) string { |
|
return fmt.Sprintf("up_ar_%d", mid) |
|
} |
|
|
|
func assetRelationField(oid int64, otype string) string { |
|
return fmt.Sprintf("%s_%d", otype, oid) |
|
} |
|
|
|
// DelCacheAssetRelationState delete asset relation state. |
|
func (d *Dao) DelCacheAssetRelationState(c context.Context, oid int64, otype string, mid int64) (err error) { |
|
var ( |
|
key = assetRelationKey(mid) |
|
field = assetRelationField(oid, otype) |
|
conn = d.redis.Get(c) |
|
) |
|
defer conn.Close() |
|
if _, err = conn.Do("HDEL", key, field); err != nil { |
|
err = errors.Wrapf(err, "conn.Do(HDEL, %s, %s)", key, field) |
|
return |
|
} |
|
return |
|
}
|
|
|