Hi,

several generators i made to avoid some duplication.

https://github.com/mh-cbon/lister

Package lister is a generator to generate typed slice.


https://github.com/mh-cbon/channeler

Package channeler is a cli generator to generate channeled version of a 
type.

https://github.com/mh-cbon/mutexer

Package mutexer is a cli generator to generate mutexed version of a type.


so basically, using below code you got hundreds of line generated for you,


in that example to make a mutexed []Tomate.


But as it s not too stupid, or tries too, it will be able to handle 

pointer and basic types

mutexed []*Tomate

mutexed []string

ect


It should also be able to lookup for a constructor of the src type (Tomate),

and reproduce it into the dest type implementation.


There is both mutexer / channeler because both cases applies for reasons.


The lister is a convenient way to create typed slice.


package demo

// Tomate is about red vegetables to make famous italian food.
type Tomate struct {
    Name string
}

// GetID return the ID of the Tomate.
func (t Tomate) GetID() string {
    return t.Name
}

//go:generate lister vegetables_gen.go Tomate:Tomates
//go:generate mutexer vegetuxed_gen.go Tomates:Tomatex

hth

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to