sstruct

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: BSD-3-Clause-Clear Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromMap added in v0.2.6

func FromMap[T any, MV any](m map[string]MV) (*T, error)

FromMap parses a map and converts it to a struct.

This is just a convenience wrapper that marshals the map to JSON and then unmarshals it to the provided struct type, and is probably wildly inefficient. But it's handy. Like your mom.

func GetTag

func GetTag[T any](s T, f, t string) (string, error)

GetTag gets the value of a struct tag by tag name.

func SetValue

func SetValue[S any, V any](s S, k string, v V) (S, error)

SetValue sets the value of a struct member by string key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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