1package apijson
2
3type status uint8
4
5const (
6 missing status = iota
7 null
8 invalid
9 valid
10)
11
12type Field struct {
13 raw string
14 status status
15}
16
17// Returns true if the field is explicitly `null` _or_ if it is not present at all (ie, missing).
18// To check if the field's key is present in the JSON with an explicit null value,
19// you must check `f.IsNull() && !f.IsMissing()`.
20func (j Field) IsNull() bool { return j.status <= null }
21func (j Field) IsMissing() bool { return j.status == missing }
22func (j Field) IsInvalid() bool { return j.status == invalid }
23func (j Field) Raw() string { return j.raw }