parser

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToAnyType

func ToAnyType[T any](input interface{}) *T

ToAnyType attempts to convert an input of any type to the specified type T. It returns a pointer to the converted value if successful, or nil if the conversion fails.

Parameters:

  • input: An interface{} representing the value to be converted.

Returns:

  • A pointer to the converted value of type T, or nil if the conversion fails.

Example:

var input interface{} = 123
result := ToAnyType[int](input)
if result != nil {
    fmt.Println(*result) // Output: 123
} else {
    fmt.Println("Conversion failed")
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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