Documentation
¶
Index ¶
- Constants
- Variables
- type Code
- func (c *Code) AddDependency(deps ...tinypkg.Node)
- func (c *Code) CollectImports(collector *tinypkg.ImportCollector) error
- func (c *Code) Dependencies() []tinypkg.Node
- func (c *Code) EmitContent(w io.Writer) error
- func (c *Code) Import(pkg *tinypkg.Package) *tinypkg.ImportedPackage
- func (c *Code) OnWalk(use func(*tinypkg.Symbol) error) error
- func (c *Code) RelativeTypeString(here *tinypkg.Package) string
- func (c *Code) String() string
- type CodeEmitter
- type Config
- type EmitCodeFunc
Constants ¶
View Source
const ( PriorityFirst = -10 PrioritySecond = -1 PriorityDefault = 0 )
View Source
const Header = `// Code generated by "github.com/podhmo/apikit"; DO NOT EDIT.
`
Variables ¶
View Source
var ErrNoImports = fmt.Errorf("no imports")
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code struct { Name string Header string Here *tinypkg.Package ImportPackages func(*tinypkg.ImportCollector) error EmitCode func(w io.Writer, c *Code) error // currently used by Config.EmitCodeFunc Priority int Config *Config // contains filtered or unexported fields }
func (*Code) AddDependency ¶
func (*Code) CollectImports ¶
func (c *Code) CollectImports(collector *tinypkg.ImportCollector) error
CollectImports is currently used by Config.EmitCodeFunc
func (*Code) Dependencies ¶
func (*Code) EmitContent ¶
EmitContent emits content only (if you want fullset version, please use c.Config.EmitCodeFunc() )
func (*Code) RelativeTypeString ¶
String : for pkg/tinypkg 's internal interface
type CodeEmitter ¶
type CodeEmitter struct {
*Code
}
func (*CodeEmitter) Emit ¶
func (c *CodeEmitter) Emit(w io.Writer) error
Emit : for pkg/emitfile.Emitter
func (*CodeEmitter) EmitImports ¶
func (c *CodeEmitter) EmitImports(w io.Writer, imports []*tinypkg.ImportedPackage) error
EmitImports is currently used by Config.EmitCodeFunc
func (*CodeEmitter) FormatBytes ¶
func (c *CodeEmitter) FormatBytes(b []byte) ([]byte, error)
Priority : for pkg/emitfile 's internal interface
func (*CodeEmitter) Priority ¶
func (c *CodeEmitter) Priority(priority *int) int
Priority : for pkg/emitfile 's internal interface
type Config ¶
type Config struct { *resolve.Config Header string DisableFormat bool EmitCodeFunc EmitCodeFunc Resolver *resolve.Resolver }
func DefaultConfig ¶
func DefaultConfig() *Config
type EmitCodeFunc ¶
type EmitCodeFunc func(w io.Writer, e *CodeEmitter) error
Click to show internal directories.
Click to hide internal directories.