types

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArgSrc arg = iota
	ArgDst
	ArgFirst  = ArgDst
	ArgSecond = ArgSrc
)

Variables

View Source
var ErrTemplate = ErrorTemplate("could not convert %#v to type %s")

Functions

func TryCast

func TryCast[T any](c Caster, val any) (conv T, err error)

Types

type Assigner

type Assigner interface {
	Assign(src, dst any) error
}

type CastError

type CastError struct {
	Target   reflect.Type
	Original any
	// contains filtered or unexported fields
}

func (CastError) Error

func (c CastError) Error() (s string)

type Caster

type Caster interface {
	OnTypeMismatch(target reflect.Type, original any) (err error)
}

type ErrorTemplate

type ErrorTemplate string

func (ErrorTemplate) OnTypeMismatch

func (et ErrorTemplate) OnTypeMismatch(target reflect.Type, original any) (err error)

type ImplAssign

type ImplAssign struct{}

func (ImplAssign) Assign

func (ImplAssign) Assign(src, dst any) error

type Kind

type Kind = reflect.Kind

type KindToSliceMeta

type KindToSliceMeta map[Kind]SliceMeta

type KindToType

type KindToType map[Kind]reflect.Type

type Meta

type Meta struct {
	Type  KindToType
	Slice KindToSliceMeta
}

type Methods

type Methods interface {
	Caster
}

type SliceMeta

type SliceMeta struct {
	Type     reflect.Type
	ElemType reflect.Type
}

Jump to

Keyboard shortcuts

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