Documentation
¶
Overview ¶
Package appgen emits a generated Go app that embeds build output.
Index ¶
- func BuildBinary(appDir, binaryPath string) (string, error)
- func BuildWASM(appDir, wasmPath string) (string, error)
- type APIEndpoint
- type ActionEndpoint
- type ActionFragment
- type ActionValidationRule
- type BackendAdapterIR
- type BackendContractExposure
- type BackendDecoder
- type BackendEndpointKind
- type BackendEndpointRegistration
- type BackendFallback
- type BackendHandlerCall
- type BackendResponse
- type FragmentEndpoint
- type Options
- type Result
- type SSRLoadReplacement
- type SSRReplacement
- type SSRRoute
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBinary ¶
BuildBinary compiles the generated app into binaryPath.
Types ¶
type APIEndpoint ¶ added in v0.1.5
type APIEndpoint struct {
PageID string
APIName string
Method string
Route string
Guards []string
ErrorPage string
Binding source.BackendBinding
BackendAlias string
}
APIEndpoint describes a generated API handler.
type ActionEndpoint ¶ added in v0.1.5
type ActionEndpoint struct {
PageID string
ActionName string
Method string
Route string
Guards []string
InputName string
InputType string
InputFields []string
RequiredFields []string
RequiredMessages map[string]string
ValidationRules []ActionValidationRule
ValidatesInput bool
Redirect string
Fragments []ActionFragment
ErrorPage string
Binding source.BackendBinding
BackendAlias string
}
ActionEndpoint describes a generated action handler.
type ActionFragment ¶
ActionFragment describes a generated partial response fragment.
type ActionValidationRule ¶ added in v0.1.5
type ActionValidationRule struct {
Field string
MinLength int
MinLengthMessage string
MaxLength int
MaxLengthMessage string
Pattern string
PatternMessage string
}
ActionValidationRule describes one generated server-side form constraint.
type BackendAdapterIR ¶ added in v0.1.5
type BackendAdapterIR struct {
Registrations []BackendEndpointRegistration
ContractExposures []BackendContractExposure
Decoders []BackendDecoder
Calls []BackendHandlerCall
Responses []BackendResponse
Fallbacks []BackendFallback
}
func (BackendAdapterIR) HasRegistrations ¶ added in v0.1.5
func (ir BackendAdapterIR) HasRegistrations() bool
type BackendContractExposure ¶ added in v0.1.5
type BackendContractExposure struct {
Endpoint BackendEndpointRegistration
Contract string
ImportAlias string
ImportPath string
Type string
Result string
Roles []string
Guards []string
InputFields []source.BackendInputField
Status gwdkir.ContractBindingStatus
Handler string
Register string
Message string
OwnerKind gwdkir.SourceKind
OwnerID string
Package string
Source string
}
type BackendDecoder ¶ added in v0.1.5
type BackendDecoder struct {
Endpoint BackendEndpointRegistration
Function string
Input string
Fields []string
}
type BackendEndpointKind ¶ added in v0.1.5
type BackendEndpointKind string
const ( BackendEndpointAction BackendEndpointKind = "action" BackendEndpointAPI BackendEndpointKind = "api" BackendEndpointFragment BackendEndpointKind = "fragment" BackendEndpointCommand BackendEndpointKind = "command" BackendEndpointQuery BackendEndpointKind = "query" )
type BackendEndpointRegistration ¶ added in v0.1.5
type BackendFallback ¶ added in v0.1.5
type BackendFallback struct {
Endpoint BackendEndpointRegistration
Status source.BackendBindingStatus
Message string
}
type BackendHandlerCall ¶ added in v0.1.5
type BackendHandlerCall struct {
Endpoint BackendEndpointRegistration
Alias string
Function string
Signature source.BackendSignatureKind
InputType string
}
type BackendResponse ¶ added in v0.1.5
type BackendResponse struct {
Endpoint BackendEndpointRegistration
NoStore bool
Partial bool
Redirect string
}
type FragmentEndpoint ¶ added in v0.1.5
type FragmentEndpoint struct {
PageID string
FragmentName string
Method string
Route string
Target string
HTML string
Package string
Uses map[string]string
Guards []string
Binding source.BackendBinding
BackendAlias string
}
FragmentEndpoint describes a generated server fragment handler.
type Options ¶
type Options struct {
Actions []ActionEndpoint
APIs []APIEndpoint
Fragments []FragmentEndpoint
SSR []SSRRoute
AutoRoutes bool
ProxyBackend bool
Config gowdk.Config
IR *gwdkir.Program
}
Options configures generated app output.
type Result ¶
type Result struct {
AppDir string
MainPath string
PackagePath string
ModulePath string
OutputDir string
Files []string
BinaryPath string
}
Result describes generated app artifacts.
func GenerateBackendWithOptions ¶ added in v0.1.5
GenerateBackendWithOptions writes a generated Go app that serves only request-time backend routes for feature-bound actions and APIs.
type SSRLoadReplacement ¶ added in v0.1.5
SSRLoadReplacement maps a generated placeholder back to a request-time load field path.
type SSRReplacement ¶
SSRReplacement maps a generated placeholder back to a request route param.
type SSRRoute ¶
type SSRRoute struct {
PageID string
Route string
Render gowdk.RenderMode
Cache string
ErrorPage string
DynamicParams []string
RouteParams []source.RouteParam
Guards []string
HasLoad bool
LoadBinding source.BackendBinding
LoadBackendAlias string
HTML string
Replacements []SSRReplacement
LoadReplacements []SSRLoadReplacement
}
SSRRoute describes a generated request-time page handler.
Source Files
¶
- adapter_ir.go
- appgen.go
- auto_routes.go
- build.go
- files.go
- ir.go
- module.go
- routes.go
- scripts.go
- source.go
- source_actions.go
- source_api.go
- source_backend.go
- source_backend_app.go
- source_contracts.go
- source_env.go
- source_fragments.go
- source_guards.go
- source_rate_limit.go
- source_ssr.go
- template.go
- types.go
- validate_actions.go
- validate_ssr.go