Pull request: aghalg: impl json.Marshaler for NullBool
Updates #4735. Squashed commit of the following: commit 93a0b1dc6b668f7d9fd89d06b8f0f24dcd345356 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Jul 11 17:02:36 2022 +0300 aghalg: impl json.Marshaler for NullBool
This commit is contained in:
@@ -40,6 +40,14 @@ func BoolToNullBool(cond bool) (nb NullBool) {
|
||||
return NBFalse
|
||||
}
|
||||
|
||||
// type check
|
||||
var _ json.Marshaler = NBNull
|
||||
|
||||
// MarshalJSON implements the json.Marshaler interface for NullBool.
|
||||
func (nb NullBool) MarshalJSON() (b []byte, err error) {
|
||||
return []byte(nb.String()), nil
|
||||
}
|
||||
|
||||
// type check
|
||||
var _ json.Unmarshaler = (*NullBool)(nil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user