bounded

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0, MIT Imports: 0 Imported by: 0

Documentation

Overview

Package bounded implements generic bounded types for validation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Type

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

Type is a bounded type. If err == nil, then T is valid.

func Failure

func Failure[T any](err error) Type[T]

func Value

func Value[T any](t T) Type[T]

func (Type[T]) Bind

func (t Type[T]) Bind(f Validator[T]) Type[T]

Bind returns a new instance of the bounded type that has been validated by f.

func (Type[T]) Maybe

func (t Type[T]) Maybe() (T, error)

type Validator

type Validator[T any] func(t T) Type[T]

Jump to

Keyboard shortcuts

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