Skip to content

Commit

Permalink
fix: 修改表名和参数名
Browse files Browse the repository at this point in the history
  • Loading branch information
Lansongxx committed Jan 20, 2024
1 parent be0be0c commit ec02032
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions biz/infrastructure/mapper/user/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
"time"
)

const CollectionName = "User"
const CollectionName = "user"

var PrefixUserCacheKey = "cache:User:"
var PrefixUserCacheKey = "cache:user:"

var _ UserMongoMapper = (*MongoMapper)(nil)
var _ IUserMongoMapper = (*MongoMapper)(nil)

type (
UserMongoMapper interface {
IUserMongoMapper interface {
Insert(ctx context.Context, data *User) (string, error) // 插入
FindOne(ctx context.Context, id string) (*User, error) // 查找
Update(ctx context.Context, data *User) (*mongo.UpdateResult, error) // 修改
Expand Down Expand Up @@ -61,14 +61,13 @@ func (m *MongoMapper) AppendAuth(ctx context.Context, id string, auth *Auth) err
return nil
}

func NewMongoMapper(config *config.Config) UserMongoMapper {
func NewMongoMapper(config *config.Config) IUserMongoMapper {
conn := monc.MustNewModel(config.Mongo.URL, config.Mongo.DB, CollectionName, config.CacheConf)
return &MongoMapper{
conn: conn,
}
}

// 通过id修改某个auth
func (m *MongoMapper) UpdateById(ctx context.Context, auth *Auth, id string) (*mongo.UpdateResult, error) {
ID, err := primitive.ObjectIDFromHex(id)
if err != nil {
Expand Down

0 comments on commit ec02032

Please sign in to comment.