opt

package
v1.66.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2024 License: BSD-3-Clause Imports: 2 Imported by: 27

Documentation

Overview

Package opt defines optional types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool string

Bool represents an optional boolean to be JSON-encoded. The string is either "true", "false", or the empty string to mean unset.

As a special case, the underlying string may also be the string "unset" as as a synonym for the empty string. This lets the explicit unset value be exchanged over an encoding/json "omitempty" field without it being dropped.

func NewBool added in v1.58.0

func NewBool(b bool) Bool

NewBool constructs a new Bool value equal to b. The returned Bool is set, unless Set("") or Clear() methods are called.

func (*Bool) Clear

func (b *Bool) Clear()

func (Bool) EqualBool added in v0.100.0

func (b Bool) EqualBool(v bool) bool

EqualBool reports whether b is equal to v. If b is empty or not a valid bool, it reports false.

func (Bool) Get

func (b Bool) Get() (v bool, ok bool)

func (Bool) MarshalJSON

func (b Bool) MarshalJSON() ([]byte, error)

func (*Bool) Scan added in v1.16.0

func (b *Bool) Scan(src any) error

Scan implements database/sql.Scanner.

func (*Bool) Set

func (b *Bool) Set(v bool)

func (*Bool) UnmarshalJSON

func (b *Bool) UnmarshalJSON(j []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL