gogen

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

func (*File) Buffer

func (f *File) Buffer() *bytes.Buffer

func (*File) Content

func (f *File) Content() ([]byte, error)

func (*File) Import

func (f *File) Import(p ImportPath)

func (*File) L

func (f *File) L(args ...interface{}) *File

func (*File) NewFuncScope

func (f *File) NewFuncScope() *Scope

func (*File) P

func (f *File) P(args ...interface{}) *File

func (*File) Path

func (f *File) Path() string

func (*File) QualifiedIdent

func (f *File) QualifiedIdent(i Ident) string

func (*File) QualifiedImportPath

func (f *File) QualifiedImportPath(path ImportPath) string

func (*File) Scope

func (f *File) Scope() *Scope

func (*File) Skip

func (f *File) Skip()

Skip may be used to skip file from generation.

func (*File) Skipped added in v0.4.0

func (f *File) Skipped() bool

func (*File) Write

func (f *File) Write(p []byte) (int, error)

func (*File) WriteFile added in v0.4.0

func (f *File) WriteFile(FS afero.Fs) error

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(os ...Option) *Generator

func (*Generator) Files

func (g *Generator) Files() []*File

func (*Generator) NewFile

func (g *Generator) NewFile(path string, importPath ImportPath) *File

NewFile returns file for given path and import path.

func (*Generator) WriteFiles

func (g *Generator) WriteFiles(fs afero.Fs) error

type Ident

type Ident struct {
	Name       string
	ImportPath ImportPath
}

func (Ident) String

func (i Ident) String() string

type ImportPath

type ImportPath string

func (ImportPath) Ident

func (p ImportPath) Ident(name string) Ident

func (ImportPath) String

func (p ImportPath) String() string

type Option

type Option func(opts *options)

func ModulePath

func ModulePath(path string) Option

type Scope

type Scope struct {
	// contains filtered or unexported fields
}

Scope contains Go identifier names from

func (*Scope) Contains

func (f *Scope) Contains(name string) bool

func (*Scope) Declare

func (f *Scope) Declare(name string) string

Declare reserves unique name for the requested name. Returned name will have no conflicts with Go universe scope and previously reserved names.

func (*Scope) Nested

func (f *Scope) Nested() *Scope

func (*Scope) Redeclare

func (f *Scope) Redeclare(name string) string

Redeclare reserves unique name for the requested name, that will shadow same name from parent scope, if it exist.

Jump to

Keyboard shortcuts

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