ListApis 分页获取API列表
(ctx context.Context, page, pageSize int)
| 66 | |
| 67 | // ListApis 分页获取API列表 |
| 68 | func (a *apiRepository) ListApis(ctx context.Context, page, pageSize int) ([]*domain.Api, int, error) { |
| 69 | // 参数校验 |
| 70 | if page <= 0 || pageSize <= 0 { |
| 71 | return nil, 0, dao.ErrInvalidMenu |
| 72 | } |
| 73 | |
| 74 | apis, total, err := a.dao.ListApis(ctx, page, pageSize) |
| 75 | if err != nil { |
| 76 | return nil, 0, err |
| 77 | } |
| 78 | return a.apisFromDAO(apis), total, nil |
| 79 | } |
| 80 | |
| 81 | // apiToDAO 将domain层的API对象转换为DAO层对象 |
| 82 | func (a *apiRepository) apiToDAO(api *domain.Api) *dao.Api { |
nothing calls this directly
no test coverage detected