maps

package
v0.30.113 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectionNone Direction = 0
	DirectionTo   Direction = 1 << iota
	DirectionFrom

	FormatRuleEquals     FormatRule = 0
	FormatRuleStartsWith FormatRule = 1 << iota
	FormatRuleEndsWith
	FormatRulePattern
	FormatRuleAll
)

Variables

View Source
var (
	ErrInvalidFormat         = errors.New("invalid format tag")
	ErrEmptyFormatIdentifier = errors.New("empty format name")
)

Functions

func All added in v0.26.0

func All[T any](
	handler miruken.Handler,
	source any,
	constraints ...any,
) (t []T, _ *promise.Promise[[]T], _ error)

Types

type Builder added in v0.22.0

type Builder struct {
	miruken.CallbackBuilder
	// contains filtered or unexported fields
}

Builder builds It callbacks.

func (*Builder) FromSource added in v0.22.0

func (b *Builder) FromSource(
	source any,
) *Builder

func (*Builder) New added in v0.22.0

func (b *Builder) New() *It

func (*Builder) WithKey added in v0.22.0

func (b *Builder) WithKey(
	key any,
) *Builder

type Direction added in v0.22.0

type Direction uint8

Direction indicates direction of formatting.

type Format added in v0.22.0

type Format struct {
	// contains filtered or unexported fields
}

Format is a Constraint for applying formatting.

func From added in v0.22.0

func From(format string, params map[string]string) *Format

From maps from a format.

func To added in v0.22.0

func To(format string, params map[string]string) *Format

To maps to a format.

func (*Format) Direction added in v0.22.0

func (f *Format) Direction() Direction

func (*Format) FlipDirection added in v0.25.0

func (f *Format) FlipDirection() *Format

func (*Format) Implied added in v0.28.0

func (f *Format) Implied() bool

func (*Format) InitWithTag added in v0.22.0

func (f *Format) InitWithTag(tag reflect.StructTag) error

func (*Format) Merge added in v0.22.0

func (f *Format) Merge(constraint miruken.Constraint) bool

func (*Format) Name added in v0.25.0

func (f *Format) Name() string

func (*Format) Params added in v0.24.0

func (f *Format) Params() map[string]string

func (*Format) Required added in v0.22.0

func (f *Format) Required() bool

func (*Format) Rule added in v0.22.0

func (f *Format) Rule() FormatRule

func (*Format) Satisfies added in v0.22.0

func (f *Format) Satisfies(required miruken.Constraint, ctx miruken.HandleContext) bool

type FormatRule added in v0.22.0

type FormatRule uint8

FormatRule describes how to interpret the format.

type It added in v0.22.0

type It struct {
	miruken.CallbackBase
	// contains filtered or unexported fields
}

It maps callbacks bivariantly.

func Into added in v0.26.0

func Into[T any](
	handler miruken.Handler,
	source any,
	target *T,
	constraints ...any,
) (p *promise.Promise[any], m *It, err error)

func Key added in v0.26.0

func Key[T any](
	handler miruken.Handler,
	key any,
	constraints ...any,
) (t T, tp *promise.Promise[T], m *It, err error)

func Out added in v0.26.0

func Out[T any](
	handler miruken.Handler,
	source any,
	constraints ...any,
) (t T, tp *promise.Promise[T], m *It, err error)

func (*It) Dispatch added in v0.22.0

func (m *It) Dispatch(
	handler any,
	greedy bool,
	composer miruken.Handler,
) miruken.HandleResult

func (*It) Key added in v0.22.0

func (m *It) Key() any

func (*It) Matched added in v0.26.0

func (m *It) Matched() *Format

func (*It) Policy added in v0.22.0

func (m *It) Policy() miruken.Policy

func (*It) SetMatched added in v0.26.0

func (m *It) SetMatched(format *Format)

func (*It) Source added in v0.22.0

func (m *It) Source() any

func (*It) String added in v0.22.0

func (m *It) String() string

type Strict added in v0.25.0

type Strict = miruken.Strict

Strict alias for mapping

Jump to

Keyboard shortcuts

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