must

package
v0.0.0-...-c8a214a Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package must is a convenience wrapper for extracting useful information out of (data, error) tuples when you really just want the data and exiting on errors is acceptable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any

func Any(i interface{}, e error) interface{}

Any returns the interface{} i or logs a fatal error e.

func Float64

func Float64(f float64, e error) float64

Float64 returns the float f or logs a fatal error e.

func Int

func Int(i int, e error) int

Int returns the int i or logs a fatal error e.

func Int64

func Int64(i int64, e error) int64

Int64 returns the int64 i or logs a fatal error e.

func Result

func Result(r *sql.Result, e error) *sql.Result

Result returns the *sql.Result r or logs a fatal error e.

func Rows

func Rows(r *sql.Rows, e error) *sql.Rows

Rows returns the *sql.Rows r or logs a fatal error e.

func ShouldIncludeStackTrace

func ShouldIncludeStackTrace(include bool)

ShouldIncludeStackTrace controles whether or not calling die will also produce a stack trace when failing. It sets a global variable so best practice is to set it once at the entry point of the application using must.

func String

func String(s string, e error) string

String returns the string s or logs a fatal error e.

func Uint

func Uint(u uint, e error) uint

Uint returns the uint u or logs a fatal error e.

func Uint64

func Uint64(u uint64, e error) uint64

Uint64 returns the uint u or logs a fatal error e.

func Work

func Work(e error)

Work will log a fatal error if e != nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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