adapt

package
v0.0.122 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package adapt provides functions to check vars interface{} type and convert interface{} to basic types: bool, int, string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v interface{}) (bool, error)

Bool convert v interface{} into bool. If v can't be converted - return ge.MismatchError{}

func Check

func Check(val reflect.Value, expectType string) error

Check compares reflect.Value with a string representation of the expected type. If the type does not match the expected one, the ge.MismatchError{} error is returned

func Int

func Int(v interface{}) (int, error)

Int convert v interface{} into int. If v can't be converted - return ge.MismatchError{}

func IsNil

func IsNil(i interface{}) bool

IsNil check interface{} is nil. and return bool value

func String

func String(v interface{}) (string, error)

String convert v interface{} into string. If v can't be converted - return ge.MismatchError{}

Types

This section is empty.

Jump to

Keyboard shortcuts

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