types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedType indicates that expected type is not
	// managed by kactus library.
	ErrUnsupportedType = errors.New("unsupported type")

	// ErrUnmatchedType indicates that value interface does not
	// match receptor type.
	ErrUnmatchedType = errors.New("type did not matched expected")
)

Functions

func AsBool

func AsBool(val interface{}) (bool, bool)

AsBool converts str, bool and int interfaces to boolean. For integer: 1 stands for true && 0 for false.

func AsFloat64

func AsFloat64(val interface{}) (float64, bool)

AsFloat64 converts int, string && float interfaces values to float64.

func AsInt64

func AsInt64(val interface{}) (int64, bool)

AsInt64 converts int && string interfaces values to int64.

func AsString

func AsString(val interface{}) (string, bool)

AsString converts any interface that as a string representation to string relying on %v format.

func AssertEqual

func AssertEqual(expected string, actual interface{}) (bool, error)

AssertEqual ensures actual interfaced value is equal to expected string typed value. Type can be ignored on string assertion only.

func Debug

func Debug()

Debug activate debug logs.

func NoLog

func NoLog()

NoLog disable logging under Fatal level.

func Reset

func Reset()

Reset matcher instance.

func ResetLog

func ResetLog()

ResetLog activate debug logs.

func SetTyped

func SetTyped(value string, to interface{}) error

SetTyped matches string value to interface receiver type.

func ToInterface

func ToInterface(value string) (interface{}, error)

ToInterface converts value to asked type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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