convert

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConvertFunc

type ConvertFunc func(string) (interface{}, error)

ConvertFunc is a function that converts a string to a typed value

type Converter

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

Converter converts string values to typed values

func New

func New() *Converter

New creates a new Converter instance

func (*Converter) Convert

func (c *Converter) Convert(value string, targetType reflect.Type, format string) (interface{}, error)

Convert converts a string value to the target type

func (*Converter) RegisterConverter

func (c *Converter) RegisterConverter(t reflect.Type, fn ConvertFunc)

RegisterConverter registers a custom converter for a type

Jump to

Keyboard shortcuts

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