errorable

package module
v0.0.0-...-eec18f2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2015 License: MIT Imports: 0 Imported by: 2

README

errorable

A Maybe Error structure for encapsulating errors on basic types

Borrowing from functional paradigms, encapsulate a maybe error idea into basic types

currently implements int and slice of int

For instance if you have a slice of strings that you want to convert to a slice of integers, but you want to account for possible conversion issues:

s := []string{"1","2","three"}

ei := NewIntErrs(strconv.Atoi,s)

will return ei where

ei.GetFirstErr() will return the error converting "three" and

ei.Get(0) == 1 ei.Get(1) == 2 ei.Get(2) == 0 (or whatever the default for Atoi is, if you care)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntErr

type IntErr struct {
	I int
	E error
}

func NewIntErr

func NewIntErr(f func(string) (int, error), s string) *IntErr

Create a errable int

type IntErrs

type IntErrs []IntErr

func NewIntErrs

func NewIntErrs(f func(string) (int, error), s ...string) *IntErrs

create an errable slice of ints by applying function f on a slice of strings

func (*IntErrs) Get

func (this *IntErrs) Get(i int) int

get the value at i, ignore errors

func (*IntErrs) GetFirstErr

func (this *IntErrs) GetFirstErr() (err error)

get the first error in the slice of errable ints

func (*IntErrs) Len

func (this *IntErrs) Len() int

length of the slice of errable ints

Directories

Path Synopsis
Godeps
_workspace/src/github.com/cihub/seelog
Package seelog implements logging functionality with flexible dispatching, filtering, and formatting.
Package seelog implements logging functionality with flexible dispatching, filtering, and formatting.
_workspace/src/github.com/jtolds/gls
Package gls implements goroutine-local storage.
Package gls implements goroutine-local storage.
_workspace/src/github.com/smartystreets/goconvey/convey
Package convey contains all of the public-facing entry points to this project.
Package convey contains all of the public-facing entry points to this project.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions
Package assertions contains the implementations for all assertions which are referenced in the convey package for use with the So(...) method.
Package assertions contains the implementations for all assertions which are referenced in the convey package for use with the So(...) method.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/oglematchers
Package oglematchers provides a set of matchers useful in a testing or mocking framework.
Package oglematchers provides a set of matchers useful in a testing or mocking framework.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/oglemock/createmock
createmock is used to generate source code for mock versions of interfaces from installed packages.
createmock is used to generate source code for mock versions of interfaces from installed packages.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/oglemock/generate
Package generate implements code generation for mock classes.
Package generate implements code generation for mock classes.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/oglemock/generate/test_cases/complicated_pkg
Package complicated_pkg contains an interface with lots of interesting cases, for use in integration testing.
Package complicated_pkg contains an interface with lots of interesting cases, for use in integration testing.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/oglemock/generate/test_cases/renamed_pkg
A package that calls itself something different than its package path would have you believe.
A package that calls itself something different than its package path would have you believe.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/ogletest
Package ogletest provides a framework for writing expressive unit tests.
Package ogletest provides a framework for writing expressive unit tests.
_workspace/src/github.com/smartystreets/goconvey/convey/gotest
Package gotest contains internal functionality.
Package gotest contains internal functionality.
_workspace/src/github.com/smartystreets/goconvey/convey/reporting
Package reporting contains internal functionality related to console reporting and output.
Package reporting contains internal functionality related to console reporting and output.

Jump to

Keyboard shortcuts

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