types

package
v0.0.0-...-a2ff9df Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NumericTypes = []string{
	"int", "int8", "int16", "int32", "int64",
	"uint", "uint8", "uint16", "uint32", "uint64",
}

Functions

func ConvertFloatDynamic

func ConvertFloatDynamic(convert func(float64) any, canBeBelowZero bool) func(any) (any, error)

func ConvertFloatToInt

func ConvertFloatToInt(in any) (any, error)

func ConvertFloatToUint

func ConvertFloatToUint(in any) (any, error)

func ConvertPassThrough

func ConvertPassThrough(in any) (any, error)

func ConvertPassThroughWithTypeValidation

func ConvertPassThroughWithTypeValidation[T any](in any) (any, error)

Types

type ConvertFunc

type ConvertFunc func(any) (any, error)

type FieldType

type FieldType struct {
	InternalToResponse ConvertFunc
	RequestToInternal  ConvertFunc
}

type FieldTypeMapper

type FieldTypeMapper struct {
	Registered map[string]FieldType
}

func DefaultFieldTypeMapper

func DefaultFieldTypeMapper() *FieldTypeMapper

func Mapper

func Mapper() *FieldTypeMapper

func (*FieldTypeMapper) Register

func (s *FieldTypeMapper) Register(typeString string, fieldType FieldType)

func (*FieldTypeMapper) ToInternalValue

func (s *FieldTypeMapper) ToInternalValue(typeString string) (ConvertFunc, error)

func (*FieldTypeMapper) ToRepresentation

func (s *FieldTypeMapper) ToRepresentation(typeString string) (ConvertFunc, error)

Jump to

Keyboard shortcuts

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