GetByID returns a host by ID.
(ctx context.Context, id string)
| 84 | |
| 85 | // GetByID returns a host by ID. |
| 86 | func (s *HostsStore) GetByID(ctx context.Context, id string) (*models.Host, error) { |
| 87 | hosts, err := s.GetByIDs(ctx, []string{id}) |
| 88 | if err != nil || len(hosts) == 0 { |
| 89 | return nil, err |
| 90 | } |
| 91 | return &hosts[0], nil |
| 92 | } |
| 93 | |
| 94 | // GetByIDs returns hosts by IDs in one query. Preserves input order. |
| 95 | func (s *HostsStore) GetByIDs(ctx context.Context, ids []string) ([]models.Host, error) { |