Files
mayfly-go/server/internal/redis/infrastructure/persistence/redis_repo.go

28 lines
773 B
Go
Raw Normal View History

package persistence
import (
2022-09-09 18:26:08 +08:00
"mayfly-go/internal/redis/domain/entity"
"mayfly-go/internal/redis/domain/repository"
"mayfly-go/pkg/base"
"mayfly-go/pkg/gormx"
"mayfly-go/pkg/model"
)
type redisRepoImpl struct {
base.RepoImpl[*entity.Redis]
}
2022-09-09 18:26:08 +08:00
func newRedisRepo() repository.Redis {
return &redisRepoImpl{base.RepoImpl[*entity.Redis]{M: new(entity.Redis)}}
2022-09-09 18:26:08 +08:00
}
2024-04-06 18:19:17 +08:00
// 分页获取redis信息列表
func (r *redisRepoImpl) GetRedisList(condition *entity.RedisQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
qd := gormx.NewQuery(new(entity.Redis)).
2024-03-02 19:08:19 +08:00
Eq("id", condition.Id).
Like("host", condition.Host).
2024-04-06 18:19:17 +08:00
Eq("code", condition.Code).
In("code", condition.Codes)
return gormx.PageQuery(qd, pageParam, toEntity)
}