alreadyDecoded returns a decoded JSON value if this jsonEncoded has already been decoded, otherwise it returns nil. This allows us to fast-path certain operations if we've already done the work of decoding an object.
()
| 42 | // been decoded, otherwise it returns nil. This allows us to fast-path certain |
| 43 | // operations if we've already done the work of decoding an object. |
| 44 | func (j *jsonEncoded) alreadyDecoded() JSON { |
| 45 | j.mu.RLock() |
| 46 | defer j.mu.RUnlock() |
| 47 | if j.mu.cachedDecoded != nil { |
| 48 | return j.mu.cachedDecoded |
| 49 | } |
| 50 | return nil |
| 51 | } |
| 52 | |
| 53 | func (j *jsonEncoded) Type() Type { |
| 54 | return j.typ |
no test coverage detected