Categorygithub.com/alecthomas/types
modulepackage
0.16.0
Repository: https://github.com/alecthomas/types.git
Documentation: pkg.go.dev

# README

Useful generic types for Go

PkgGoDev GHA Build Slack chat

I've found myself reimplementing some small types and patterns in a lot of my recent Go projects, so I thought I'd distill them into a single package.

Refer to the package docs for details.

# Packages

Package either provides a simple implementation of a sum type, Either, that can be either a Left or a Right.
Package eventsource provides a pubsub.Topic that also stores the last published value in an atomic.Value.
Package must provides a way to panic if the result of a multi-value function call returns an error, or return just the values if there is no error.
Package once provides a way to call a function exactly once (memoisation).
Package optional provides an Option type that can contain a value or nothing.
Package pubsub provides a simple publish/subscribe mechanism.
Package result provides a Result type that can contain a value or an error.
Package tuple provides pseudo-tuple types.