()
| 40 | } |
| 41 | |
| 42 | func (opp *operationPack) Id() entity.Id { |
| 43 | if opp.id == "" || opp.id == entity.UnsetId { |
| 44 | // This means we are trying to get the opp's Id *before* it has been stored. |
| 45 | // As the Id is computed based on the actual bytes written on the disk, we are going to predict |
| 46 | // those and then get the Id. This is safe as it will be the exact same code writing on disk later. |
| 47 | |
| 48 | data, err := json.Marshal(opp) |
| 49 | if err != nil { |
| 50 | panic(err) |
| 51 | } |
| 52 | opp.id = entity.DeriveId(data) |
| 53 | } |
| 54 | |
| 55 | return opp.id |
| 56 | } |
| 57 | |
| 58 | func (opp *operationPack) MarshalJSON() ([]byte, error) { |
| 59 | return json.Marshal(struct { |
nothing calls this directly
no test coverage detected