null

package module
v0.0.0-...-39dd88f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 1 Imported by: 8

README

null

Package null provides nullable types for Discord's API. This really isn't any different than any other nullable types library out there.

License

MIT

Documentation

Overview

Package null implements nullable types for use with Discord's API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool struct {
	Value bool
	Valid bool
}

Bool is a nullable boolean.

func BoolFrom

func BoolFrom(b bool) Bool

BoolFrom creates a new, valid bool from the given value.

func NullBool

func NullBool() Bool

NullBool creates a new, invalid bool.

func (Bool) MarshalJSON

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

MarshalJSON marshals b into JSON.

func (*Bool) UnmarshalJSON

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

UnmarshalJSON unmarshals raw into b.

type Int

type Int struct {
	Value int
	Valid bool
}

Int is a nullable int.

func IntFrom

func IntFrom(i int) Int

IntFrom creates a new, valid int.

func NullInt

func NullInt() Int

NullInt creates a new, invalid int.

func (Int) MarshalJSON

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

MarshalJSON marshals i into JSON.

func (*Int) UnmarshalJSON

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

UnmarshalJSON unmarshals b into i.

type String

type String struct {
	Value string
	Valid bool
}

String is a nullable JSON string.

func NewNullString

func NewNullString() String

NewNullString creates a nullable String that is set to null.

func StringFrom

func StringFrom(str string) String

StringFrom creates a nullable String from the given value.

func (String) MarshalJSON

func (s String) MarshalJSON() ([]byte, error)

MarshalJSON marshals s into JSON.

func (*String) UnmarshalJSON

func (s *String) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals b into s.

Jump to

Keyboard shortcuts

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