Files
mayfly-go/server/internal/db/infrastructure/persistence/db_sql_exec.go

30 lines
834 B
Go
Raw Normal View History

2022-09-09 18:26:08 +08:00
package persistence
import (
"mayfly-go/internal/db/domain/entity"
"mayfly-go/internal/db/domain/repository"
"mayfly-go/pkg/biz"
"mayfly-go/pkg/gormx"
2022-09-09 18:26:08 +08:00
"mayfly-go/pkg/model"
)
type dbSqlExecRepoImpl struct{}
func newDbSqlExecRepo() repository.DbSqlExec {
return new(dbSqlExecRepoImpl)
}
func (d *dbSqlExecRepoImpl) Insert(dse *entity.DbSqlExec) {
gormx.Insert(dse)
2022-09-09 18:26:08 +08:00
}
func (d *dbSqlExecRepoImpl) DeleteBy(condition *entity.DbSqlExec) {
biz.ErrIsNil(gormx.DeleteByCondition(condition), "删除sql执行记录失败")
2022-09-09 18:26:08 +08:00
}
// 分页获取
func (d *dbSqlExecRepoImpl) GetPageList(condition *entity.DbSqlExec, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult[any] {
qd := gormx.NewQuery(condition).WithCondModel(condition).WithOrderBy(orderBy...)
return gormx.PageQuery(qd, pageParam, toEntity)
2022-09-09 18:26:08 +08:00
}