Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncError ¶
AsyncError represents a value which could either be a synchronous error or an asynchronous error (sent through a channel). It wraps the more generic `Either` type specific for error channels.
func AsyncErr ¶
func AsyncErr(errCh chan error) AsyncError
AsyncErr creates an AsyncError from an error channel. It wraps the error channel into the right field (conventionally associated with successful values in the Either pattern) of the Either type.
func SyncErr ¶
func SyncErr(err error) AsyncError
SyncErr creates an AsyncError either from a synchronous error. It wraps the Error into the left field (conventionally associated with the error value in the Either pattern) of the Either type. It casts the result to the AsyncError type.
func (AsyncError) IsAsyncError ¶
func (soaErr AsyncError) IsAsyncError() bool
IsAsyncError checks if the AsyncError represents an asynchronous error (sent through a channel).
func (AsyncError) IsSyncError ¶
func (soaErr AsyncError) IsSyncError() bool
IsSyncError checks if the AsyncError represents a synchronous error.
func (AsyncError) SyncOrAsyncError ¶
func (soaErr AsyncError) SyncOrAsyncError() (error, chan error)
SyncOrAsyncError decomposes the AsyncError into its components, returning a synchronous error and an error channel. If the AsyncError represents a synchronous error, the error channel will be nil and vice versa.
type Either ¶
type Either[R any] struct { // contains filtered or unexported fields }
Either represents a type that can hold either a value of type T or an error. It's commonly used in functional programming to encapsulate functions that might fail. This way, instead of returning a value and an error separately, both are combined into a single type.
func (Either[T]) ValueOrError ¶
ValueOrError unpacks the Either value.
type SessionTrees ¶ added in v0.0.2
type SessionTrees = Either[[]relayer.SessionTree]