genchi

package
v0.0.0-...-fdde285 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProviderModule

func ProviderModule(here *tinypkg.Package, resolver *resolve.Resolver, providerName string) (*providerModule, error)

func RuntimeModule

func RuntimeModule(here *tinypkg.Package, resolver *resolve.Resolver) (*runtimeModule, error)

func ToHandlerCode

func ToHandlerCode(
	here *tinypkg.Package,
	config *code.Config,
	analyzed *Analyzed,
	metadata web.MetaData,
) *code.CodeEmitter

func WriteHandlerFunc

func WriteHandlerFunc(w io.Writer,
	here *tinypkg.Package,
	analyzed *Analyzed,
	name string,
	defaultStatusCode int,
) error

Types

type Analyzed

type Analyzed struct {
	*webgen.Analyzed
	RuntimeModule  *runtimeModule
	ProviderModule *providerModule
}

type Analyzer

type Analyzer struct {
	Resolver *resolve.Resolver
	Tracker  *resolve.Tracker

	ProviderModule *providerModule
	// contains filtered or unexported fields
}

func (*Analyzer) Analyze

func (a *Analyzer) Analyze(here *tinypkg.Package, node *web.WalkerNode) (*Analyzed, error)

type Config

type Config struct {
	*code.Config
	Tracker      *resolve.Tracker
	ProviderName string
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) New

func (c *Config) New(emitter *emitgo.Emitter) *Generator

func (*Config) NewPackage

func (c *Config) NewPackage(path, name string) *tinypkg.Package

func (*Config) Override

func (c *Config) Override(name string, fn interface{}) (*resolve.Def, error)

type Generator

type Generator struct {
	*Config

	Emitter *emitgo.Emitter
	Tracker *resolve.Tracker

	RootPkg     *tinypkg.Package
	ProviderPkg *tinypkg.Package
	RouterPkg   *tinypkg.Package
	HandlerPkg  *tinypkg.Package
	RuntimePkg  *tinypkg.Package

	Handlers []Handler
}

func (*Generator) ActivatePlugins

func (g *Generator) ActivatePlugins(ctx context.Context, here *tinypkg.Package, targets ...plugins.Plugin) error

func (*Generator) Generate

func (g *Generator) Generate(
	ctx context.Context,
	r *web.Router,
	getHTTPStatusFromError func(error) int,
) error

type Handler

type Handler struct {
	Method string
	Path   string

	RawFn       interface{}
	HandlerFunc *tinypkg.Func
	MetaData    web.MetaData
	Analyzed    *Analyzed
}

Jump to

Keyboard shortcuts

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