GetInstance finds an instance by ID
(tx *storage.Connection, instanceID uuid.UUID)
| 56 | |
| 57 | // GetInstance finds an instance by ID |
| 58 | func GetInstance(tx *storage.Connection, instanceID uuid.UUID) (*Instance, error) { |
| 59 | instance := Instance{} |
| 60 | if err := tx.Find(&instance, instanceID); err != nil { |
| 61 | if errors.Cause(err) == sql.ErrNoRows { |
| 62 | return nil, InstanceNotFoundError{} |
| 63 | } |
| 64 | return nil, errors.Wrap(err, "error finding instance") |
| 65 | } |
| 66 | return &instance, nil |
| 67 | } |
| 68 | |
| 69 | func GetInstanceByUUID(tx *storage.Connection, uuid uuid.UUID) (*Instance, error) { |
| 70 | instance := Instance{} |
no test coverage detected
searching dependent graphs…