codegen

package
v0.0.0-...-61829c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTempFile

func CreateTempFile(filename, content string) func()

func DeVendor

func DeVendor(importPath string) string

func Generate

func Generate(generator Generator)

func GeneratedSuffix

func GeneratedSuffix(filename string) string

func GetPackageImportPath

func GetPackageImportPath(dir string) string

func IsGoFile

func IsGoFile(filename string) bool

func IsGoTextFile

func IsGoTextFile(filename string) bool

func Rewords

func Rewords(s string, reducer RewordsReducer) string

func SplitToWords

func SplitToWords(s string) (entries []string)

func ToCamelCase

func ToCamelCase(s string) string

func ToLowerCamelCase

func ToLowerCamelCase(s string) string

func ToLowerLinkCase

func ToLowerLinkCase(s string) string

func ToLowerSnakeCase

func ToLowerSnakeCase(s string) string

func ToUpperCamelCase

func ToUpperCamelCase(s string) string

func ToUpperFirst

func ToUpperFirst(s string) string

func ToUpperSnakeCase

func ToUpperSnakeCase(s string) string

func WriteFile

func WriteFile(filename string, content string)

Types

type GenFile

type GenFile struct {
	Filename string
	PkgName  string
	Data     interface{}
	*bytes.Buffer
	*Importer
}

func NewGenFile

func NewGenFile(pkgName string, filename string) *GenFile

func (*GenFile) Block

func (f *GenFile) Block(tpl string) *GenFile

func (*GenFile) OutputTo

func (f *GenFile) OutputTo(outputs Outputs)

func (*GenFile) String

func (f *GenFile) String() string

func (*GenFile) WithData

func (f *GenFile) WithData(data interface{}) *GenFile

type Generator

type Generator interface {
	Load(cwd string)
	Pick()
	Output(cwd string) Outputs
}

type ImportPkg

type ImportPkg struct {
	*build.Package
	Alias string
}

func (*ImportPkg) GetID

func (importPkg *ImportPkg) GetID() string

func (*ImportPkg) String

func (importPkg *ImportPkg) String() string

type Importer

type Importer struct {
	Local string
	// contains filtered or unexported fields
}

func (*Importer) ExposeVar

func (importer *Importer) ExposeVar(name string) string

func (*Importer) Import

func (importer *Importer) Import(importPath string, alias bool) *ImportPkg

func (*Importer) PureUse

func (importer *Importer) PureUse(importPath string, subPkgs ...string) string

func (*Importer) Sdump

func (importer *Importer) Sdump(v interface{}) string

func (*Importer) String

func (importer *Importer) String() string

func (*Importer) Type

func (importer *Importer) Type(tpe reflect.Type) string

func (*Importer) Use

func (importer *Importer) Use(importPath string, subPkgs ...string) string

use and alias

func (*Importer) Var

func (importer *Importer) Var(name string) string

func (*Importer) WriteToImports

func (importer *Importer) WriteToImports(w io.Writer)

type Outputs

type Outputs map[string]string

func (Outputs) Add

func (outputs Outputs) Add(filename string, content string)

func (Outputs) WriteFile

func (outputs Outputs) WriteFile(filename string, content string)

func (Outputs) WriteFiles

func (outputs Outputs) WriteFiles()

type RewordsReducer

type RewordsReducer func(result string, word string, index int) string

Directories

Path Synopsis
fixtures
package
package

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL