Assets returns the names of all assets in the respository.
()
| 85 | |
| 86 | // Assets returns the names of all assets in the respository. |
| 87 | func (s *SQLRepository) Assets() ([]string, error) { |
| 88 | rows, err := s.assetsQuery.Query() |
| 89 | if err != nil { |
| 90 | return nil, fmt.Errorf("unable to get assets: %w", err) |
| 91 | } |
| 92 | |
| 93 | defer helper.CloseDatabaseRows(rows) |
| 94 | |
| 95 | var assets []string |
| 96 | |
| 97 | for rows.Next() { |
| 98 | var name string |
| 99 | |
| 100 | err := rows.Scan(&name) |
| 101 | if err != nil { |
| 102 | return nil, fmt.Errorf("unable to scan assets: %w", err) |
| 103 | } |
| 104 | |
| 105 | assets = append(assets, name) |
| 106 | } |
| 107 | |
| 108 | return assets, nil |
| 109 | } |
| 110 | |
| 111 | // Get attempts to return a channel of snapshots for the asset with the given name. |
| 112 | func (s *SQLRepository) Get(name string) (<-chan *Snapshot, error) { |