refconv

package
v0.9.17 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package refconv implements the Converter interface by using the standard libraries reflection package.

Package refconv implements the Converter interface by using the standard libraries reflection package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conv

type Conv struct{}

Conv implements the Converter interface by using the reflection package. It will never panic, does not require initialization or share state so is safe for use by multiple Goroutines.

func (Conv) Bool

func (c Conv) Bool(from interface{}) (bool, error)

Bool attempts to convert the given value to bool, returns the zero value and an error on failure.

func (Conv) Duration

func (c Conv) Duration(from interface{}) (time.Duration, error)

Duration attempts to convert the given value to time.Duration, returns the zero value and an error on failure.

func (Conv) Float32

func (c Conv) Float32(from interface{}) (float32, error)

Float32 attempts to convert the given value to Float32, returns the zero value and an error on failure.

func (Conv) Float64

func (c Conv) Float64(from interface{}) (float64, error)

Float64 attempts to convert the given value to float64, returns the zero value and an error on failure.

func (Conv) Infer

func (c Conv) Infer(into, from interface{}) error

Infer will perform conversion by inferring the conversion operation from the T of `into`.

func (Conv) Int

func (c Conv) Int(from interface{}) (int, error)

Int attempts to convert the given value to int, returns the zero value and an error on failure.

func (Conv) Int16

func (c Conv) Int16(from interface{}) (int16, error)

Int16 attempts to convert the given value to int16, returns the zero value and an error on failure.

func (Conv) Int32

func (c Conv) Int32(from interface{}) (int32, error)

Int32 attempts to convert the given value to int32, returns the zero value and an error on failure.

func (Conv) Int64

func (c Conv) Int64(from interface{}) (int64, error)

Int64 attempts to convert the given value to int64, returns the zero value and an error on failure.

func (Conv) Int8

func (c Conv) Int8(from interface{}) (int8, error)

Int8 attempts to convert the given value to int8, returns the zero value and an error on failure.

func (Conv) String

func (c Conv) String(from interface{}) (string, error)

String returns the string representation from the given interface{} value and can not currently fail. Although an error is currently provided only for API cohesion you should still check it to be future proof.

func (Conv) Time

func (c Conv) Time(from interface{}) (time.Time, error)

Time attempts to convert the given value to time.Time, returns the zero value of time.Time and an error on failure.

func (Conv) Uint

func (c Conv) Uint(from interface{}) (uint, error)

Uint attempts to convert the given value to uint, returns the zero value and an error on failure.

func (Conv) Uint16

func (c Conv) Uint16(from interface{}) (uint16, error)

Uint16 attempts to convert the given value to uint16, returns the zero value and an error on failure.

func (Conv) Uint32

func (c Conv) Uint32(from interface{}) (uint32, error)

Uint32 attempts to convert the given value to uint32, returns the zero value and an error on failure.

func (Conv) Uint64

func (c Conv) Uint64(from interface{}) (uint64, error)

Uint64 attempts to convert the given value to uint64, returns the zero value and an error on failure.

func (Conv) Uint8

func (c Conv) Uint8(from interface{}) (uint8, error)

Uint8 attempts to convert the given value to uint8, returns the zero value and an error on failure.

Jump to

Keyboard shortcuts

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