controller

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name        string
	Pascal      string
	Camel       string
	Short       string
	View        *View
	Key         string // Key is an extension-less path
	Route       string // Route to this action
	Redirect    string
	Method      string
	Context     *Context
	Params      []*ActionParam
	Input       string
	Results     ActionResults
	RespondJSON bool
	RespondHTML bool
	PropsKey    string
}

Action is the target action state

type ActionParam

type ActionParam struct {
	Name     string
	Pascal   string
	Snake    string
	Type     string
	Kind     string
	Variable string
	Tag      string
}

ActionParam struct

func (*ActionParam) IsContext

func (ap *ActionParam) IsContext() bool

type ActionResult

type ActionResult struct {
	Name     string
	Pascal   string
	Named    bool
	Snake    string
	Type     string
	Kind     parser.Kind
	Variable string
	IsError  bool
	Fields   []*ActionResultField
	Methods  []*ActionResultMethod
}

ActionResult struct

type ActionResultField

type ActionResultField struct {
	Name string
	Type string
	Tag  string
}

ActionResultField struct

type ActionResultMethod

type ActionResultMethod struct {
}

ActionResultMethod struct

type ActionResults

type ActionResults []*ActionResult

ActionResults fn

func (ActionResults) Error

func (results ActionResults) Error() string

Error expression if there is one

func (ActionResults) Result

func (results ActionResults) Result() string

Result expression if there is one

func (ActionResults) Set

func (results ActionResults) Set() string

Set helper

func (ActionResults) ViewResult

func (results ActionResults) ViewResult() string

type Context

type Context struct {
	Function string // Name of the function
	Code     string // Function code
	Fields   []*ContextField
	Results  ContextResults
}

Context is the target context state

type ContextField

type ContextField struct {
	Name     string
	Variable string
	Hoisted  bool
	Type     string
}

ContextField struct

type ContextResult

type ContextResult struct {
	Variable string
}

ContextResult struct

type ContextResults

type ContextResults []*ContextResult

ContextResults is a list of context results

func (ContextResults) Error

func (outputs ContextResults) Error() string

Error returns the error variable if there is one

func (ContextResults) List

func (outputs ContextResults) List() string

List joins the outputs with a comma

func (ContextResults) Result

func (outputs ContextResults) Result() string

Result returns the result variable if there is one

type Controller

type Controller struct {
	Name        string
	Pascal      string
	JSON        string
	Path        string // Path to controller without action dir
	Route       string
	Actions     []*Action
	Controllers []*Controller
}

Controller is the target controller state

func (*Controller) Last

func (c *Controller) Last() Name

type Generator

type Generator struct {
	Injector *di.Injector
	Module   *gomod.Module
	Parser   *parser.Parser
}

func (*Generator) GenerateFile

func (g *Generator) GenerateFile(ctx context.Context, fsys overlay.F, file *overlay.File) error

type Name

type Name string

func (Name) Pascal

func (n Name) Pascal() string

type State

type State struct {
	Imports    []*imports.Import
	Controller *Controller
	Contexts   []*Context
}

func Load

func Load(fsys fs.FS, injector *di.Injector, module *gomod.Module, parser *parser.Parser) (*State, error)

type View

type View struct {
	Route string
}

View struct

Jump to

Keyboard shortcuts

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