Initial commit

This commit is contained in:
Donny
2019-04-22 20:46:32 +08:00
commit 49ab8aadd1
25441 changed files with 4055000 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
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
}