swipe

package
v3.0.28 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(cfg *Config, prefix string) (result map[string]*GenerateResult, errs []error)

func Options

func Options() (data map[string][]byte)

func RegisterPlugin

func RegisterPlugin(id string, cb func() Plugin)

func TypeString

func TypeString(v interface{}, onlySign bool, importer Importer) string

func TypeStringWithoutImport

func TypeStringWithoutImport(v interface{}, onlySign bool) string

Types

type AstFinder

type AstFinder interface {
	FindImplIface(ifaceType option.IfaceType)
}

type Config

type Config struct {
	WorkDir       string
	Envs          []string
	Patterns      []string
	Modules       map[string]*option.Module
	Module        *packages.Module
	Packages      *packages2.Packages
	CommentFuncs  map[string][]string
	CommentFields *ast.CommentFields
}

func GetConfig

func GetConfig(loader *ast.Loader) (*Config, error)

func (*Config) Load

func (c *Config) Load() (err error)

func (*Config) WalkBuilds

func (c *Config) WalkBuilds(fn func(module *option.Module, build *option.Inject) bool)

type ContextKey

type ContextKey string
const (
	ImporterKey ContextKey = "importer"
)

type GenerateResult

type GenerateResult struct {
	PkgName    string
	PkgPath    string
	OutputPath string
	Imports    []string
	Content    []byte
	Errs       []error
}

type Generator

type Generator interface {
	Generate(ctx context.Context) []byte
	OutputPath() string
	Filename() string
}

type GeneratorPackage

type GeneratorPackage interface {
	Package() string
}

type Importer

type Importer interface {
	Import(name string, path string) string
}

type Plugin

type Plugin interface {
	ID() string
	Configure(cfg *Config, module *option.Module, options map[string]interface{}) []error
	Generators() ([]Generator, []error)
	Options() []byte
}

type PluginConfig

type PluginConfig struct {
	Plugin Plugin
	Build  *option.Inject
	Module *option.Module
}

Jump to

Keyboard shortcuts

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