apiutil

package
v2.1.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeferClose

func DeferClose(c io.Closer, err *error)

DeferClose captures the error returned from closing (if an error occurs). This is designed to be used in a defer statement.

func ReadJSON

func ReadJSON(r io.ReadCloser, data interface{}) error

ReadJSON reads a JSON data from r and then closes it. An error due to invalid json will be returned as a JSONError

Types

type FieldError

type FieldError struct {
	// contains filtered or unexported fields
}

FieldError connects an error to a particular field

func ParseUint64VarsField

func ParseUint64VarsField(vars map[string]string, varName string) (uint64, *FieldError)

ParseUint64VarsField connects strconv.ParseUint with request variables It hardcodes the base to 10 and bitsize to 64 Any error returned will connect the requested field to the error via FieldError

type JSONError

type JSONError struct {
	Err error
}

JSONError lets callers check for just one error type

func (JSONError) Error

func (e JSONError) Error() string

Jump to

Keyboard shortcuts

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