mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 17:45:59 +08:00
style: add format
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
@@ -3,9 +3,10 @@ package relation
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/db/table/relation"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ObjectHashGorm struct {
|
||||
@@ -24,7 +25,11 @@ func (o *ObjectHashGorm) NewTx(tx any) relation.ObjectHashModelInterface {
|
||||
}
|
||||
}
|
||||
|
||||
func (o *ObjectHashGorm) Take(ctx context.Context, hash string, engine string) (oh *relation.ObjectHashModel, err error) {
|
||||
func (o *ObjectHashGorm) Take(
|
||||
ctx context.Context,
|
||||
hash string,
|
||||
engine string,
|
||||
) (oh *relation.ObjectHashModel, err error) {
|
||||
oh = &relation.ObjectHashModel{}
|
||||
return oh, utils.Wrap1(o.DB.Where("hash = ? and engine = ?", hash, engine).Take(oh).Error)
|
||||
}
|
||||
@@ -33,7 +38,11 @@ func (o *ObjectHashGorm) Create(ctx context.Context, h []*relation.ObjectHashMod
|
||||
return utils.Wrap1(o.DB.Create(h).Error)
|
||||
}
|
||||
|
||||
func (o *ObjectHashGorm) DeleteNoCitation(ctx context.Context, engine string, num int) (list []*relation.ObjectHashModel, err error) {
|
||||
func (o *ObjectHashGorm) DeleteNoCitation(
|
||||
ctx context.Context,
|
||||
engine string,
|
||||
num int,
|
||||
) (list []*relation.ObjectHashModel, err error) {
|
||||
err = o.DB.Table(relation.ObjectHashModelTableName, "as h").Select("h.*").
|
||||
Joins("LEFT JOIN "+relation.ObjectInfoModelTableName+" as i ON h.hash = i.hash").
|
||||
Where("h.engine = ? AND i.hash IS NULL", engine).
|
||||
|
||||
Reference in New Issue
Block a user