hailin/internal/mods/rbac/biz/logger.biz.go
2025-06-19 10:30:46 +08:00

32 lines
772 B
Go

package biz
import (
"context"
"github.com/guxuan/hailin_service/internal/mods/rbac/dal"
"github.com/guxuan/hailin_service/internal/mods/rbac/schema"
"github.com/guxuan/hailin_service/pkg/util"
)
// Logger management
type Logger struct {
LoggerDAL *dal.Logger
}
// Query loggers from the data access object based on the provided parameters and options.
func (a *Logger) Query(ctx context.Context, params schema.LoggerQueryParam) (*schema.LoggerQueryResult, error) {
params.Pagination = true
result, err := a.LoggerDAL.Query(ctx, params, schema.LoggerQueryOptions{
QueryOptions: util.QueryOptions{
OrderFields: []util.OrderByParam{
{Field: "created_at", Direction: util.DESC},
},
},
})
if err != nil {
return nil, err
}
return result, nil
}