Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 6.1% on proxy.golang.org
Top 4.2% dependent packages on proxy.golang.org
Top 2.5% dependent repos on proxy.golang.org

proxy.golang.org : 4d63.com/optional

Package optional exports an Optional[T] type that can wrap any type to represent the lack of value. The types guarantee safety by requiring the developer to unwrap them to get to the inner value. This prevents a nil value being operated on. Optionals marshal to XML and JSON like their underlying type, and omitempty works just like their wrapped type would with a pointer, but without the use of pointers. These types are an alternative to using pointers, zero values, or similar null wrapper packages. Unlike similar solutions these will omit correctly from XML and JSON without the use of pointers and the compiler will ensure their value is not used when empty. Wrap a pointer in an optional: Unwrap it safely: Or get it's value with a fallback to a default: XML and JSON are supported out of the box. Use `omitempty` to omit the field when the optional is empty:

Registry - Source - Documentation - JSON
purl: pkg:golang/4d63.com/optional
License: MIT
Latest release: about 2 years ago
First release: about 3 years ago
Namespace: 4d63.com
Dependent packages: 2
Dependent repositories: 4
Stars: 34 on GitHub
Forks: 2 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 24 days ago

    Loading...
    Readme
    Loading...