opt

package module
v0.0.0-...-7424302 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: MIT Imports: 0 Imported by: 0

README

opt - Optional Types for Go

Optional types for Go (golang)

Build Status codecov Go Report Card GoDoc

Documentation

Overview

Package opt contains a set of optional types. Optional types provide programmers with a better means of distinguishing a value's "is set" state compared to using a possibly-nil pointer.

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 is an optional type that wraps a bool.

func MakeBool

func MakeBool(v bool) Bool

MakeBool creates a new Bool with the specified value.

func (Bool) Get

func (p Bool) Get() bool

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Bool) IsSet

func (p Bool) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Bool) Set

func (p *Bool) Set(v bool)

Set sets the optional type's value.

type Byte

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

Byte is an optional type that wraps a byte.

func MakeByte

func MakeByte(v byte) Byte

MakeByte creates a new Byte with the specified value.

func (Byte) Get

func (p Byte) Get() byte

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Byte) IsSet

func (p Byte) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Byte) Set

func (p *Byte) Set(v byte)

Set sets the optional type's value.

type Complex128

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

Complex128 is an optional type that wraps a complex128.

func MakeComplex128

func MakeComplex128(v complex128) Complex128

MakeComplex128 creates a new Complex128 with the specified value.

func (Complex128) Get

func (p Complex128) Get() complex128

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Complex128) IsSet

func (p Complex128) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Complex128) Set

func (p *Complex128) Set(v complex128)

Set sets the optional type's value.

type Complex64

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

Complex64 is an optional type that wraps a complex64.

func MakeComplex64

func MakeComplex64(v complex64) Complex64

MakeComplex64 creates a new Complex64 with the specified value.

func (Complex64) Get

func (p Complex64) Get() complex64

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Complex64) IsSet

func (p Complex64) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Complex64) Set

func (p *Complex64) Set(v complex64)

Set sets the optional type's value.

type Float32

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

Float32 is an optional type that wraps a float32.

func MakeFloat32

func MakeFloat32(v float32) Float32

MakeFloat32 creates a new Float32 with the specified value.

func (Float32) Get

func (p Float32) Get() float32

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Float32) IsSet

func (p Float32) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Float32) Set

func (p *Float32) Set(v float32)

Set sets the optional type's value.

type Float64

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

Float64 is an optional type that wraps a float64.

func MakeFloat64

func MakeFloat64(v float64) Float64

MakeFloat64 creates a new Float64 with the specified value.

func (Float64) Get

func (p Float64) Get() float64

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Float64) IsSet

func (p Float64) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Float64) Set

func (p *Float64) Set(v float64)

Set sets the optional type's value.

type Int

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

Int is an optional type that wraps a int.

func MakeInt

func MakeInt(v int) Int

MakeInt creates a new Int with the specified value.

func (Int) Get

func (p Int) Get() int

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Int) IsSet

func (p Int) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Int) Set

func (p *Int) Set(v int)

Set sets the optional type's value.

type Int16

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

Int16 is an optional type that wraps a int16.

func MakeInt16

func MakeInt16(v int16) Int16

MakeInt16 creates a new Int16 with the specified value.

func (Int16) Get

func (p Int16) Get() int16

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Int16) IsSet

func (p Int16) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Int16) Set

func (p *Int16) Set(v int16)

Set sets the optional type's value.

type Int32

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

Int32 is an optional type that wraps a int32.

func MakeInt32

func MakeInt32(v int32) Int32

MakeInt32 creates a new Int32 with the specified value.

func (Int32) Get

func (p Int32) Get() int32

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Int32) IsSet

func (p Int32) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Int32) Set

func (p *Int32) Set(v int32)

Set sets the optional type's value.

type Int64

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

Int64 is an optional type that wraps a int64.

func MakeInt64

func MakeInt64(v int64) Int64

MakeInt64 creates a new Int64 with the specified value.

func (Int64) Get

func (p Int64) Get() int64

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Int64) IsSet

func (p Int64) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Int64) Set

func (p *Int64) Set(v int64)

Set sets the optional type's value.

type Int8

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

Int8 is an optional type that wraps a int8.

func MakeInt8

func MakeInt8(v int8) Int8

MakeInt8 creates a new Int8 with the specified value.

func (Int8) Get

func (p Int8) Get() int8

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Int8) IsSet

func (p Int8) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Int8) Set

func (p *Int8) Set(v int8)

Set sets the optional type's value.

type Rune

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

Rune is an optional type that wraps a rune.

func MakeRune

func MakeRune(v rune) Rune

MakeRune creates a new Rune with the specified value.

func (Rune) Get

func (p Rune) Get() rune

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Rune) IsSet

func (p Rune) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Rune) Set

func (p *Rune) Set(v rune)

Set sets the optional type's value.

type String

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

String is an optional type that wraps a string.

func MakeString

func MakeString(v string) String

MakeString creates a new String with the specified value.

func (String) Get

func (p String) Get() string

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (String) IsSet

func (p String) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*String) Set

func (p *String) Set(v string)

Set sets the optional type's value.

type Uint

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

Uint is an optional type that wraps a uint.

func MakeUint

func MakeUint(v uint) Uint

MakeUint creates a new Uint with the specified value.

func (Uint) Get

func (p Uint) Get() uint

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Uint) IsSet

func (p Uint) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Uint) Set

func (p *Uint) Set(v uint)

Set sets the optional type's value.

type Uint16

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

Uint16 is an optional type that wraps a uint16.

func MakeUint16

func MakeUint16(v uint16) Uint16

MakeUint16 creates a new Uint16 with the specified value.

func (Uint16) Get

func (p Uint16) Get() uint16

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Uint16) IsSet

func (p Uint16) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Uint16) Set

func (p *Uint16) Set(v uint16)

Set sets the optional type's value.

type Uint32

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

Uint32 is an optional type that wraps a uint32.

func MakeUint32

func MakeUint32(v uint32) Uint32

MakeUint32 creates a new Uint32 with the specified value.

func (Uint32) Get

func (p Uint32) Get() uint32

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Uint32) IsSet

func (p Uint32) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Uint32) Set

func (p *Uint32) Set(v uint32)

Set sets the optional type's value.

type Uint64

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

Uint64 is an optional type that wraps a uint64.

func MakeUint64

func MakeUint64(v uint64) Uint64

MakeUint64 creates a new Uint64 with the specified value.

func (Uint64) Get

func (p Uint64) Get() uint64

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Uint64) IsSet

func (p Uint64) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Uint64) Set

func (p *Uint64) Set(v uint64)

Set sets the optional type's value.

type Uint8

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

Uint8 is an optional type that wraps a uint8.

func MakeUint8

func MakeUint8(v uint8) Uint8

MakeUint8 creates a new Uint8 with the specified value.

func (Uint8) Get

func (p Uint8) Get() uint8

Get returns the underlying value wrapped by the optional type. If IsSet returns false, then Get's return value will be the zero value for the underlying type.

func (Uint8) IsSet

func (p Uint8) IsSet() bool

IsSet returns a value indicating whether the optional type's value is set.

func (*Uint8) Set

func (p *Uint8) Set(v uint8)

Set sets the optional type's value.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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