GetVolume returns a volume by ID with host info.
(ctx context.Context, id string)
| 621 | |
| 622 | // GetVolume returns a volume by ID with host info. |
| 623 | func (s *DockerStore) GetVolume(ctx context.Context, id string) (*VolumeDetail, error) { |
| 624 | d := s.db.DB(ctx) |
| 625 | v, err := d.Queries.GetVolumeByID(ctx, id) |
| 626 | if err != nil { |
| 627 | return nil, err |
| 628 | } |
| 629 | |
| 630 | hostRows, _ := d.Queries.GetDockerHostsByIDs(ctx, []string{v.HostID}) |
| 631 | var hostPtr *HostInfo |
| 632 | if len(hostRows) > 0 { |
| 633 | hostPtr = dockerHostDetailRowToHostInfo(hostRows[0]) |
| 634 | } |
| 635 | |
| 636 | return &VolumeDetail{ |
| 637 | Volume: dbDockerVolumeToModel(v), |
| 638 | Hosts: hostPtr, |
| 639 | }, nil |
| 640 | } |
| 641 | |
| 642 | // VolumeDetail is volume with host. |
| 643 | type VolumeDetail struct { |
nothing calls this directly
no test coverage detected