GetNetwork returns a network by ID with host info.
(ctx context.Context, id string)
| 727 | |
| 728 | // GetNetwork returns a network by ID with host info. |
| 729 | func (s *DockerStore) GetNetwork(ctx context.Context, id string) (*NetworkDetail, error) { |
| 730 | d := s.db.DB(ctx) |
| 731 | n, err := d.Queries.GetNetworkByID(ctx, id) |
| 732 | if err != nil { |
| 733 | return nil, err |
| 734 | } |
| 735 | |
| 736 | hostRows, _ := d.Queries.GetDockerHostsByIDs(ctx, []string{n.HostID}) |
| 737 | var hostPtr *HostInfo |
| 738 | if len(hostRows) > 0 { |
| 739 | hostPtr = dockerHostDetailRowToHostInfo(hostRows[0]) |
| 740 | } |
| 741 | |
| 742 | return &NetworkDetail{ |
| 743 | Network: dbDockerNetworkToModel(n), |
| 744 | Hosts: hostPtr, |
| 745 | }, nil |
| 746 | } |
| 747 | |
| 748 | // NetworkDetail is network with host. |
| 749 | type NetworkDetail struct { |
nothing calls this directly
no test coverage detected