Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
func New ¶
func New(s string) *Aggregator
func (*Aggregator) CheckAndAdd ¶
func (a *Aggregator) CheckAndAdd(err error) bool
CheckAndAdd appends the given error to the Aggregator's error list if it is not nil. Returns false if the error was added, true otherwise.
This method is intended to be used with nil checks, e.g.:
if data, err := someFunc(); a.CheckAndAdd(err) {
// No error, do something with data
}
func (*Aggregator) CheckPredicateAndAdd ¶
func (a *Aggregator) CheckPredicateAndAdd(predicate bool, errorMessage string) bool
CheckPredicateAndAdd evaluates the given predicate and, if it is false, appends the given error message to the Aggregator's error list. Returns the value of the predicate.
Example:
if a.CheckPredicateAndAdd(data != "", "no data found") {
// Data is not empty, do something with it
}
func (*Aggregator) Error ¶
func (a *Aggregator) Error() string
Error returns a string with all errors concatenated, joined by a semicolon.
func (*Aggregator) ErrorOrNil ¶
func (a *Aggregator) ErrorOrNil() error
ErrorOrNil returns any errors reported, or nil if none.
Click to show internal directories.
Click to hide internal directories.