优化mongo,封装count逻辑,处理objectId
This commit is contained in:
@@ -238,6 +238,9 @@ func (m *MongoDB) Find(ctx context.Context, filter bson.M, result interface{}, c
|
|||||||
optionsKey := fmt.Sprintf("%+v%+v", page, orderBy)
|
optionsKey := fmt.Sprintf("%+v%+v", page, orderBy)
|
||||||
redisKey := fmt.Sprintf(redis.List, user.TenantId, collection, filterKey, optionsKey)
|
redisKey := fmt.Sprintf(redis.List, user.TenantId, collection, filterKey, optionsKey)
|
||||||
resultValue := reflect.ValueOf(result)
|
resultValue := reflect.ValueOf(result)
|
||||||
|
if resultValue.IsNil() || resultValue.IsZero() {
|
||||||
|
return errors.New("result不能为空")
|
||||||
|
}
|
||||||
resultValue = resultValue.Elem()
|
resultValue = resultValue.Elem()
|
||||||
listField := resultValue.FieldByName("List")
|
listField := resultValue.FieldByName("List")
|
||||||
if m.Cache {
|
if m.Cache {
|
||||||
|
|||||||
Reference in New Issue
Block a user