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:
Ainar Garipov
2022-07-11 17:40:00 +03:00
parent a832987f7c
commit bf024fb985
2 changed files with 54 additions and 0 deletions

View File

@@ -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)