templates

package
v0.0.0-...-5e0d6b7 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Optional

type Optional optional

func Empty

func Empty() Optional

Empty returns an empty optional.

func Of

func Of(value T) Optional

Of wraps the value in an optional.

func OfOptionalPtr

func OfOptionalPtr(ptr *T) Optional

func (Optional) Else

func (o Optional) Else(elseValue T) (value T)

Else returns the value wrapped by this optional, or the value passed in if there is no value wrapped by this optional.

func (Optional) ElseFunc

func (o Optional) ElseFunc(f func() T) (value T)

func (Optional) Get

func (o Optional) Get() (value T, ok bool)

Get returns the value wrapped by this optional, and an ok signal for whether a value was wrapped.

func (Optional) GormDataType

func (c Optional) GormDataType() string

func (Optional) If

func (o Optional) If(f func(value T))

If calls the function if there is a value wrapped by this optional.

func (Optional) IsBlank

func (o Optional) IsBlank() bool

func (Optional) IsNil

func (o Optional) IsNil() bool

func (Optional) IsPresent

func (o Optional) IsPresent() bool

func (Optional) MarshalJSON

func (o Optional) MarshalJSON() (data []byte, err error)

MarshalJSON marshals the value being wrapped to JSON. If there is no vale being wrapped, the zero value of its type is marshaled.

func (*Optional) MarshalText

func (o *Optional) MarshalText() ([]byte, error)

func (Optional) MarshalXML

func (o Optional) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML marshals the value being wrapped to XML. If there is no vale being wrapped, the zero value of its type is marshaled.

func (*Optional) Scan

func (c *Optional) Scan(input interface{}) (err error)

func (Optional) String

func (o Optional) String() string

String returns the string representation of the wrapped value, or the string representation of the zero value of the type wrapped if there is no value wrapped by this optional.

func (*Optional) UnmarshalJSON

func (o *Optional) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the JSON into a value wrapped by this optional.

func (*Optional) UnmarshalText

func (o *Optional) UnmarshalText(data []byte) error

func (*Optional) UnmarshalXML

func (o *Optional) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML unmarshals the XML into a value wrapped by this optional.

func (Optional) V

func (o Optional) V() (value T)

V returns the value wrapped by this optional, or the zero value of the type wrapped if there is no value wrapped by this optional.

func (Optional) Value

func (c Optional) Value() (driver.Value, error)

type T

type T string

template type Optional(T,scan)

Jump to

Keyboard shortcuts

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