utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConvertArrayInterface     = errors.New("unable to convert to []interface{}")
	ErrConvertArrayString        = errors.New("unable to convert to []string")
	ErrConvertMapStringInterface = errors.New("unable to convert to map[string]interface{}")
	ErrConvertString             = errors.New("unable to convert to string")
)

Functions

func CloseFile

func CloseFile(file io.ReadCloser)

CloseFile safely closes a file handle.

func Glob

func Glob(pattern string) ([]string, error)

Glob adds double-star support to the core path/filepath Glob function. It's useful when your globs might have double-stars, but you're not sure.

func ReadStream

func ReadStream(fileName string) (io.ReadCloser, error)

func ToArrayInterface

func ToArrayInterface(in interface{}) ([]interface{}, error)

ToArrayInterface attempts a conversion from an interface to an underlying array of interface type. Returns an error if the conversion is not possible.

func ToArrayString

func ToArrayString(in interface{}) ([]string, error)

ToArrayString attempts a conversion from an interface to an underlying array of string type. Returns an error if the conversion is not possible.

func ToMapStringInterface

func ToMapStringInterface(in interface{}) (map[string]interface{}, error)

ToMapStringInterface attempts a conversion from an interface to an underlying map string interface type. Returns an error if the conversion is not possible.

func ToString

func ToString(in interface{}) (string, error)

ToArrayInterface attempts a conversion from an interface to an underlying string type. Returns an error if the conversion is not possible.

Types

This section is empty.

Jump to

Keyboard shortcuts

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