Our great sponsors
-
set
Package set is a small wrapper around the official reflect package that facilitates loose type conversion and assignment into native Go types.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Sorry for two replies but I ran my TypeInfo benchmarks with and without caching if you're interested in also sharing the impact. The benchmarks are in https://github.com/nofeaturesonlybugs/set/blob/master/type_info_test.go
I also like the approach that the hujson library takes, where everything is a type Literal []byte and you can call (Literal).Bool(), (Literal).String(), (Literal).Int() or (Literal).Float() on it and it gives you the corresponding value out of it (or the zero value). So kinda like dynamic variables that can store anything.