Documentation
¶
Overview ¶
Package genclient provides a generator for the client tool and package of a goa application. The generator creates a main.go file and a subpackage containing data structures specific to the service.
The generated code includes a client package with:
- One client method per resource action
- Helper functions to build the corresponding request paths
- Structs for the action payloads and dependent types
- Structs for the action media types and corresponding decoder functions
The generated code also includes a CLI tool with commands for each action and sub-commands for each resource.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Generator ¶
type Generator struct {
API *design.APIDefinition // The API definition
OutDir string // Path to output directory
Target string // Name of generated package
ToolDirName string // Name of tool directory where CLI main is generated once
Tool string // Name of CLI tool
NoTool bool // Whether to skip tool generation
// contains filtered or unexported fields
}
Generator is the application code generator.
func NewGenerator ¶ added in v1.2.0
func NewGenerator(options ...Option) *Generator
NewGenerator returns an initialized instance of a Go Client Generator
type Option ¶ added in v1.2.0
type Option func(*Generator)
Option a generator option definition
func NoTool ¶ added in v1.2.0
func NoTool(noTool bool) Option
NoTool Whether to skip tool generation
func ToolDirName ¶ added in v1.2.0
func ToolDirName(toolDirName string) Option
ToolDirName Name of tool directory where CLI main is generated once
Click to show internal directories.
Click to hide internal directories.