init: taotie-api 项目初始化
This commit is contained in:
39
repo/userrepo.go
Normal file
39
repo/userrepo.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"taotie-api/common"
|
||||
"taotie-api/model/po"
|
||||
)
|
||||
|
||||
type UserRepo[T IEntity] struct {
|
||||
BaseRepo[T]
|
||||
}
|
||||
|
||||
func NewUserRepo(mdb *MongoDb) *UserRepo[*po.TUser] {
|
||||
return &UserRepo[*po.TUser]{
|
||||
BaseRepo[*po.TUser]{
|
||||
mdb: mdb,
|
||||
tableName: "tuser",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (rp *UserRepo[T]) FindOneByTenantIdAndUserName(ctx context.Context, tenantId string, userName string) (result T, err error) {
|
||||
result, err = rp.RawFindOne(ctx, &QueryParams{
|
||||
Where: common.Map{
|
||||
"tenantId": tenantId,
|
||||
"userName": userName,
|
||||
},
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (rp *UserRepo[T]) Update(ctx context.Context, qp *QueryParams, setData map[string]any) error {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user