null

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: Apache-2.0 Imports: 0 Imported by: 2

README

null 🚫

GoDoc Go Report Card Build Status Codecov

Simple library for null values in Go

This library provides simple primitives for nullable variables. Int, Bool, and Float are supported.

	var b null.Bool // This is null

	b.Set(false) // This is false
	b.Set(true) // This is true
	b.Unset() // This is null again.

Pull Requests Welcome

Please use GitHub to make suggestions, pull requests, and enhancements. We're all in this together! 🚫

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

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

Bool provides a nullable bool

func NewBool

func NewBool(value bool) Bool

NewBool returns a fully populated, nullable bool

func (Bool) Get

func (b Bool) Get() bool

Get returns the actual value of this object

func (Bool) IsNull

func (b Bool) IsNull() bool

IsNull returns TRUE if this value is null

func (Bool) IsPresent

func (b Bool) IsPresent() bool

IsPresent returns TRUE if this value is present

func (*Bool) Set

func (b *Bool) Set(value bool)

Set applies a new value to the nullable item

func (*Bool) Unset

func (b *Bool) Unset()

Unset removes the value from this item, and sets it to null

type Float

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

Float provides a nullable float64

func NewFloat

func NewFloat(value float64) Float

NewFloat returns a fully populated, nullable float64

func (Float) Get

func (f Float) Get() float64

Get returns the actual value of this object

func (Float) IsNull

func (f Float) IsNull() bool

IsNull returns TRUE if this value is null

func (Float) IsPresent

func (f Float) IsPresent() bool

IsPresent returns TRUE if this value is present

func (*Float) Set

func (f *Float) Set(value float64)

Set applies a new value to the nullable item

func (*Float) Unset

func (f *Float) Unset()

Unset removes the value from this item, and sets it to null

type Int

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

Int provides a nullable bool

func NewInt

func NewInt(value int) Int

NewInt returns a fully populated, nullable bool

func (Int) Get

func (i Int) Get() int

Get returns the actual value of this object

func (Int) IsNull

func (i Int) IsNull() bool

IsNull returns TRUE if this value is null

func (Int) IsPresent

func (i Int) IsPresent() bool

IsPresent returns TRUE if this value is present

func (*Int) Set

func (i *Int) Set(value int)

Set applies a new value to the nullable item

func (*Int) Unset

func (i *Int) Unset()

Unset removes the value from this item, and sets it to null

Jump to

Keyboard shortcuts

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