helpers

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseIndexedValues

func ParseIndexedValues(onDefault OnDefault, onIndexed OnIndexed, values ...string) error

ParseIndexedValues parses given indexed values, where indexed value is a string in form <index>:<value> or <value>, if indexed value doesn't have ':' separator, that it is assumed as default one. Both onDefault and onIndexed arguments are required.

Types

type Hex

type Hex []byte

Hex string

func (Hex) MarshalJSON

func (h Hex) MarshalJSON() ([]byte, error)

impl json.Marshaler for Hex

func (*Hex) UnmarshalJSON

func (h *Hex) UnmarshalJSON(data []byte) error

impl json.Unmarshaler for Hex

type OnDefault

type OnDefault func(string) error

type OnIndexed

type OnIndexed func(uint32, string) error

type Option

type Option[T any] func(T) error

Generic option

type Options

type Options[T any] []Option[T]

Generic option slice

func (Options[T]) Apply

func (opts Options[T]) Apply(obj T) error

Apply all the options

type Result added in v1.0.0

type Result[T any] struct {
	// contains filtered or unexported fields
}

func Error added in v1.0.0

func Error[T any](err error) Result[T]

func Ok added in v1.0.0

func Ok[T any](ok T) Result[T]

func (*Result[T]) Unwrap added in v1.0.0

func (r *Result[T]) Unwrap() (T, error)

func (*Result[T]) UnwrapOr added in v1.0.0

func (r *Result[T]) UnwrapOr(value T) T

Jump to

Keyboard shortcuts

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