Documentation ¶
Index ¶
- Variables
- func GetPkgToLoad() string
- type FileOut
- type FilesOut
- type PkgImport
- type PkgImports
- func (t *PkgImports) At(i int) PkgImport
- func (t *PkgImports) Contains(s PkgImport) bool
- func (t *PkgImports) Empty() bool
- func (t *PkgImports) Filter(filters ...func(PkgImport) bool) *PkgImports
- func (t *PkgImports) First() PkgImport
- func (t *PkgImports) Get() []PkgImport
- func (t *PkgImports) Index(s PkgImport) int
- func (t *PkgImports) InsertAt(i int, s PkgImport) *PkgImports
- func (t *PkgImports) Last() PkgImport
- func (t *PkgImports) Len() int
- func (t *PkgImports) Map(mappers ...func(PkgImport) PkgImport) *PkgImports
- func (t *PkgImports) Pop() PkgImport
- func (t *PkgImports) Push(x ...PkgImport) *PkgImports
- func (t *PkgImports) Remove(s PkgImport) bool
- func (t *PkgImports) RemoveAt(i int) bool
- func (t *PkgImports) Reverse() *PkgImports
- func (t *PkgImports) Set(x []PkgImport) *PkgImports
- func (t *PkgImports) Shift() PkgImport
- func (t *PkgImports) Slice(start int, length int) []PkgImport
- func (t *PkgImports) Splice(start int, length int, s ...PkgImport) []PkgImport
- func (t *PkgImports) Unshift(x ...PkgImport) *PkgImports
- type TransformArg
- type TransformArgs
Constants ¶
This section is empty.
Variables ¶
var FilterPkgImports = struct { ByPath func(string) func(PkgImport) bool ByID func(string) func(PkgImport) bool }{ ByPath: func(v string) func(PkgImport) bool { return func(o PkgImport) bool { return o.Path == v } }, ByID: func(v string) func(PkgImport) bool { return func(o PkgImport) bool { return o.ID == v } }, }
FilterPkgImports provides filters for a struct.
Functions ¶
Types ¶
type FileOut ¶
type FileOut struct { GeneratorName string PkgName string Path string Body bytes.Buffer Imports PkgImports }
FileOut ...
type PkgImports ¶
type PkgImports struct {
// contains filtered or unexported fields
}
PkgImports implements a typed slice of PkgImport
func NewPkgImports ¶
func NewPkgImports() *PkgImports
NewPkgImports creates a new typed slice of PkgImport
func (*PkgImports) Contains ¶
func (t *PkgImports) Contains(s PkgImport) bool
Contains returns true if s in is t.
func (*PkgImports) Empty ¶
func (t *PkgImports) Empty() bool
Empty returns true if the slice is empty.
func (*PkgImports) Filter ¶
func (t *PkgImports) Filter(filters ...func(PkgImport) bool) *PkgImports
Filter return a new PkgImports with all items satisfying f.
func (*PkgImports) First ¶
func (t *PkgImports) First() PkgImport
First returns the first value or default.
func (*PkgImports) Index ¶
func (t *PkgImports) Index(s PkgImport) int
Index of given PkgImport. It must implements Ider interface.
func (*PkgImports) InsertAt ¶
func (t *PkgImports) InsertAt(i int, s PkgImport) *PkgImports
InsertAt adds given PkgImport at index i
func (*PkgImports) Last ¶
func (t *PkgImports) Last() PkgImport
Last returns the last value or default.
func (*PkgImports) Map ¶
func (t *PkgImports) Map(mappers ...func(PkgImport) PkgImport) *PkgImports
Map return a new PkgImports of each items modified by f.
func (*PkgImports) Pop ¶
func (t *PkgImports) Pop() PkgImport
Pop removes then returns the last PkgImport.
func (*PkgImports) Push ¶
func (t *PkgImports) Push(x ...PkgImport) *PkgImports
Push appends every PkgImport
func (*PkgImports) Remove ¶
func (t *PkgImports) Remove(s PkgImport) bool
Remove removes given PkgImport
func (*PkgImports) RemoveAt ¶
func (t *PkgImports) RemoveAt(i int) bool
RemoveAt removes a PkgImport at index i.
func (*PkgImports) Shift ¶
func (t *PkgImports) Shift() PkgImport
Shift removes then returns the first PkgImport.
func (*PkgImports) Slice ¶
func (t *PkgImports) Slice(start int, length int) []PkgImport
Slice returns a copied slice of PkgImport, starting at start, ending at start+length.
func (*PkgImports) Splice ¶
func (t *PkgImports) Splice(start int, length int, s ...PkgImport) []PkgImport
Splice removes and returns a slice of PkgImport, starting at start, ending at start+length. If any s is provided, they are inserted in place of the removed slice.
func (*PkgImports) Unshift ¶
func (t *PkgImports) Unshift(x ...PkgImport) *PkgImports
Unshift prepends every PkgImport
type TransformArg ¶
type TransformArg struct { FromPkgPath string FromTypeName string ToPkgPath string ToTypeName string ToPath string }
TransformArg is a parsed cli arg.
func (TransformArg) String ¶
func (t TransformArg) String() string
type TransformArgs ¶
type TransformArgs struct { PkgBase string Args []TransformArg }
TransformArgs parse cli args.
func (TransformArgs) Parse ¶
func (t TransformArgs) Parse(args []string) (TransformArgs, error)
Parse cli arguments.