(_ context.Context)
| 35 | ) |
| 36 | |
| 37 | func (s *sqlDatabase) ListAllPools(_ context.Context) ([]params.Pool, error) { |
| 38 | var pools []Pool |
| 39 | |
| 40 | q := s.conn. |
| 41 | Preload("Tags"). |
| 42 | Preload("Organization"). |
| 43 | Preload("Organization.Endpoint"). |
| 44 | Preload("Repository"). |
| 45 | Preload("Repository.Endpoint"). |
| 46 | Preload("Enterprise"). |
| 47 | Preload("Enterprise.Endpoint"). |
| 48 | Omit("extra_specs"). |
| 49 | Find(&pools) |
| 50 | if q.Error != nil { |
| 51 | return nil, fmt.Errorf("error fetching all pools: %w", q.Error) |
| 52 | } |
| 53 | |
| 54 | ret := make([]params.Pool, len(pools)) |
| 55 | var err error |
| 56 | for idx, val := range pools { |
| 57 | ret[idx], err = s.sqlToCommonPool(val) |
| 58 | if err != nil { |
| 59 | return nil, fmt.Errorf("error converting pool: %w", err) |
| 60 | } |
| 61 | } |
| 62 | return ret, nil |
| 63 | } |
| 64 | |
| 65 | func (s *sqlDatabase) GetPoolByID(_ context.Context, poolID string) (params.Pool, error) { |
| 66 | preloadList := []string{ |
no test coverage detected