Skip to content

Latest commit

 

History

History
156 lines (106 loc) · 5.91 KB

TYPEWRITERS.md

File metadata and controls

156 lines (106 loc) · 5.91 KB

Typewriters

This is a list of known open-source typewriters in alphabetical order. GoDoc links are to the original implementation that might use interface{} instead of a gen type. Typewriters that would benefit from some improvement are listed at the bottom. Please add your own by making a pull request. Make sure you have documented the code before submitting a pull request.

Heap GoDoc

gen add github.com/nickmab/gen/typewriters/container

// +gen container:"Heap, HeapBy"
type MyType struct{}

Implements a strongly-typed heap, based on golang.org/pkg/container/heap. A heap is a tree with the property that each node is the minimum-valued node in its subtree. Useful implementation of a priority queue.

LinkedList GoDoc

gen add github.com/clipperhouse/linkedlist

// +gen list
type MyType struct{}

Implements a strongly-typed, doubly-linked list, based on golang.org/pkg/container/list.

Map, Atomic GoDoc

gen add github.com/ninibe/atomicmapper/gen

// +gen atomicmap
type MyType struct{}

Atomicmapper is a code generation tool for creating high-performance, scalable, frequently read, but infrequently updated maps of strings to any given map[string]MyType. It is based on Go's atomic.Value read mostly example.

Ring GoDoc

gen add github.com/clipperhouse/ring

// +gen ring
type MyType struct{}

Implements strongly-typed operations on circular lists, based on golang.org/pkg/container/ring.

Set GoDoc

gen add github.com/clipperhouse/set

// +gen set
type MyType struct{}

Implements a strongly-typed unordered set with unique values, based on github.com/deckarep/golang-set.

Signal GoDoc

gen add github.com/jackc/signal

// +gen signal
type MyType struct{}

Implements the signal pattern. github.com/jackc/signal.

Slice GoDoc

github.com/clipperhouse/slice built-in typewriter, no need to install

// +gen slice:"Aggregate[T], All, Any, Average, Average[T], Count, Distinct, DisctinctBy, First, GroupBy[T], Max, Max[T], Min, Min[T], MinBy, Select[T], Shuffle, Sort, SortBy, Where"
type MyType struct{}

Generates functional convenience methods that will look familiar to users of C#’s LINQ or JavaScript’s Array methods. It is intended to save you some loops, using a “pass a function” pattern. It offers easier ad-hoc sorts. Documentation is available at clipperhouse.github.io/gen/slice.

Stack GoDoc

gen add github.com/svett/gen/stack

// +gen stack
type MyType struct{}

Implements a Stack.

Stringer GoDoc

github.com/clipperhouse/stringer built-in typewriter, no need to install

// +gen stringer
type Pill int

const (
    Placebo Pill = iota
    Aspirin
    Ibuprofen
    Paracetamol
    Acetaminophen = Paracetamol
)

Generates an implementation of the Stringer interface from const variable names, for pretty-printing, based on golang.org/x/tools/cmd/stringer.

Queue GoDoc

gen add github.com/ggaaooppeenngg/queue

// +gen queue
type MyType struct{}

Implements a queue.

Improvable typewriters

Feel free to help these typewriters by making installation easier, improving documentation, writing tests or improving the implementation.

Flags GoDoc

gen add github.com/michaelsmanley/flags

// +gen flags"
type MyType struct{}

Convenience functions for manipulating flags, in the bitset sense.

Sequences GoDoc

gen add github.com/fernandokm/sequences

// +gen sequenceGenerator:"Iterator[int64,uint64,*bigInt]"
type MyType struct{}

Generates an implementation of a generator of primes, fibonacci or triangular numbers using a given type.

Slice extension GoDoc

github.com/remz/golang-sdk/gen_extras extends the built-in slice implementation, adding new functions

// These are the new functions added by this slice extension:
// +gen slice:"AddOnce, Contains, Cut, Expand, Extend, FillRange, Find, Insert, InsertMultiple, IsEqualTo, MakeCopy, Mapping, Pop, Push, Remove, RemoveValue, ZeroUpTo"
type MyType struct{}

Extends the Slice implementation by adding some more functions. Current implementation requires copying files into the Slice implementation folder and rebuilding gen.