optional

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Int

type Int struct {
	// contains filtered or unexported fields
}

Int represents an optional int.

func NewInt

func NewInt(i int) *Int

NewInt returns a new optional int set to i.

func NewNilInt

func NewNilInt() *Int

NewNilInt returns a new optional int set to nil.

func (*Int) Int

func (i *Int) Int() int

Int returns the integer value when set, otherwise it panics.

func (*Int) IntOrDefault

func (i *Int) IntOrDefault(v int) int

IntOrDefault returns the integer value when set, otherwise returns the default value.

func (*Int) MarshalJSON

func (i *Int) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Int) Set

func (i *Int) Set() bool

Set returns whether the int value has been set.

func (*Int) String

func (i *Int) String() string

String implements the fmt.Stringer interface.

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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