Xe
slice · gen · type-driven code generation for Go

home Quick start Annotations Usage FAQ typewriters Listing Adding Implementing slice Aggregate[T] All Any Average Average[T] Count Distinct DistinctBy First GroupBy[T] Max Max[T] MaxBy Min Min[T] MinBy Select[T] Shuffle Sort SortBy Where stringer optional Set List Ring source · changelog gen (v4) slice The slice typewriter is built into gen by default. It 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. The annotation looks like: // +gen slice:"Where,GroupBy[int],Any" type Example struct {} ( Example is used as a placeholder for your type.) A new type, ExampleSlice , is generated and becomes the receiver for the methods below. Iterates over a slice, operating...

Linked on 2015-03-02 16:48:39 | Similar Links