func (n NullBoolean) MarshalText() ([]byte, error) {
	if !n.Valid {
		return nil, errMarshalNull
	}
	return []byte(strconv.FormatBool(n.Bool)), nil
}
MarshalText marshals the boolean to "true" or "false". It returns an error
if n.Valid is false.
package graphql
import (
	"strconv"
	"golang.org/x/xerrors"
)
type Nullable interface {
	IsGraphQLNull() bool
}
func isGraphQLNull(x interface{}) bool {
	n, ok := x.(Nullable)
	return ok && n.IsGraphQLNull()
}
type NullInt struct {
	Int   int32
	Valid bool
}
func (n NullInt) IsGraphQLNull() bool {
	return !n.Valid
}
func (n NullInt) String() string {
	if !n.Valid {
		return "null"
	}
	return strconv.FormatInt(int64(n.Int), 10)
}
func (n NullInt) MarshalText() ([]byte, error) {
	if !n.Valid {
		return nil, errMarshalNull
	}
	return strconv.AppendInt(nil, int64(n.Int), 10), nil
}
func (n *NullInt) UnmarshalText(text []byte) error {
	i, err := strconv.ParseInt(string(text), 10, 32)
	if err != nil {
		return xerrors.Errorf("unmarshal: invalid int: %w", err)
	}
	*n = NullInt{Valid: true, Int: int32(i)}
	return nil
}
type NullFloat struct {
	Float float64
	Valid bool
}
func (n NullFloat) IsGraphQLNull() bool {
	return !n.Valid
}
func (n NullFloat) String() string {
	if !n.Valid {
		return "null"
	}
	return strconv.FormatFloat(n.Float, 'g', -1, 64)
}
func (n NullFloat) MarshalText() ([]byte, error) {
	if !n.Valid {
		return nil, errMarshalNull
	}
	return strconv.AppendFloat(nil, n.Float, 'g', -1, 64), nil
}
func (n *NullFloat) UnmarshalText(text []byte) error {
	f, err := strconv.ParseFloat(string(text), 64)
	if err != nil {
		return xerrors.Errorf("unmarshal: invalid float: %w", err)
	}
	*n = NullFloat{Valid: true, Float: f}
	return nil
}
type NullString struct {
	S     string
	Valid bool
}
func (n NullString) IsGraphQLNull() bool {
	return !n.Valid
}
func (n NullString) String() string {
	if !n.Valid {
		return "null"
	}
	return n.S
}
func (n NullString) MarshalText() ([]byte, error) {
	if !n.Valid {
		return nil, errMarshalNull
	}
	return []byte(n.S), nil
}
func (n *NullString) UnmarshalText(text []byte) error {
	*n = NullString{Valid: true, S: string(text)}
	return nil
}
type NullBoolean struct {
	Bool  bool
	Valid bool
}
func (n NullBoolean) IsGraphQLNull() bool {
	return !n.Valid
}
func (n NullBoolean) String() string {
	switch {
	case n.Valid && n.Bool:
		return "true"
	case n.Valid && !n.Bool:
		return "false"
	default:
		return "null"
	}
}