builtintypes

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBoolHandler

func NewBoolHandler(_ reflect.Type) readpipeline.TypedHandler[bool]

func NewFloatHandler

func NewFloatHandler(fieldType reflect.Type) readpipeline.TypedHandler[float64]

func NewIntHandler

func NewIntHandler(fieldType reflect.Type) readpipeline.TypedHandler[int64]

func NewJsonPipelineBuilder

func NewJsonPipelineBuilder(targetType reflect.Type) readpipeline.TypedHandler[any]

func NewStringHandler

func NewStringHandler(_ reflect.Type) readpipeline.TypedHandler[string]

NewStringHandler returns a TypedHandler[string] that simply returns the raw value. Strings support the min and max tags for lexical ordering and the pattern tag for regex

func NewTypeRegistry

func NewTypeRegistry() readpipeline.TypeRegistry

NewTypeRegistry creates a new TypeRegistry with the default handlers. Types registered here will override the default handlers for this registry instance only

func NewTypedBoolHandler

func NewTypedBoolHandler() readpipeline.TypedHandler[bool]

NewTypedBoolHandler returns a TypedHandler[bool] that uses standard bool parsing and validation.

func NewTypedDurationHandler

func NewTypedDurationHandler() readpipeline.TypedHandler[time.Duration]

NewTypedDurationHandler returns a TypedHandler[time.Duration] that uses standard duration parsing and validation.

func NewTypedFloatHandler

func NewTypedFloatHandler(bits int) readpipeline.TypedHandler[float64]

NewTypedFloatHandler returns a TypedHandler[float64] that uses standard float parsing and validation.

func NewTypedIntHandler

func NewTypedIntHandler(bits int) readpipeline.TypedHandler[int64]

NewTypedIntHandler returns a TypedHandler[int64] that uses standard int parsing and validation.

func NewTypedStringHandler

func NewTypedStringHandler() readpipeline.TypedHandler[string]

NewTypedStringHandler returns a TypedHandler[string] that uses standard string parsing and validation.

func NewTypedUintHandler

func NewTypedUintHandler(bits int) readpipeline.TypedHandler[uint64]

NewTypedUintHandler returns a TypedHandler[uint64] that uses standard uint parsing and validation.

func NewUintHandler

func NewUintHandler(fieldType reflect.Type) readpipeline.TypedHandler[uint64]

func NewUrlTypedHandler

func NewUrlTypedHandler() readpipeline.TypedHandler[*url.URL]

func RegisterType

func RegisterType[T any](handler readpipeline.TypedHandler[T])

RegisterType registers a custom PipelineBuilder for a given type in the root registry.

func WrapProcessUsingPatternTag

func WrapProcessUsingPatternTag(tags reflect.StructTag, processor readpipeline.FieldProcessor[string]) (readpipeline.FieldProcessor[string], error)

WrapProcessUsingPatternTag applies the pattern tag validation if present.

func WrapProcessUsingRangeTags

func WrapProcessUsingRangeTags[T cmp.Ordered](tags reflect.StructTag, processor readpipeline.FieldProcessor[T]) (readpipeline.FieldProcessor[T], error)

WrapProcessUsingRangeTags applies the min and max tags to an ordered readpipeline.

Types

type LocalTypeRegistry

type LocalTypeRegistry struct {
	Parent              readpipeline.TypeRegistry
	SpecialTypeHandlers map[reflect.Type]readpipeline.PipelineBuilder
}

func (*LocalTypeRegistry) HandlerFor

func (*LocalTypeRegistry) RegisterType

func (r *LocalTypeRegistry) RegisterType(t reflect.Type, handler readpipeline.PipelineBuilder)

type RootTypeRegistry

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

RootTypeRegistry is a registry of Handlers factories for specific types. Handlers can be registered for specific types or for a category of types keyed on Kind. If a handler is registered for a specific type, it will be used instead of the category handler. If a handler is registered for a category, a factory method is called to instantiate the handler given the type.

func (*RootTypeRegistry) HandlerFor

HandlerFor returns the readpipeline.PipelineBuilder for the given type, or nil if none is registered.

func (*RootTypeRegistry) RegisterKind

func (r *RootTypeRegistry) RegisterKind(kind reflect.Kind, factory readpipeline.HandlerFactory)

RegisterKind registers a factory method for a given Kind.

func (*RootTypeRegistry) RegisterType

func (r *RootTypeRegistry) RegisterType(t reflect.Type, handler readpipeline.PipelineBuilder)

RegisterType registers a custom readpipeline.PipelineBuilder for a given type.

Jump to

Keyboard shortcuts

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