hasPricing reports whether the cost block has at least one populated price. Returns false for a nil receiver, so callers can pass m.Cost without a preceding nil check.
()
| 57 | // Returns false for a nil receiver, so callers can pass m.Cost without a |
| 58 | // preceding nil check. |
| 59 | func (c *upstreamCost) hasPricing() bool { |
| 60 | if c == nil { |
| 61 | return false |
| 62 | } |
| 63 | return c.Input != nil || c.Output != nil || |
| 64 | c.CacheRead != nil || c.CacheWrite != nil |
| 65 | } |
| 66 | |
| 67 | // Pointer fields preserve the distinction between "not populated by upstream" |
| 68 | // (null) and "explicitly zero" (0). |