Documentation ¶
Overview ¶
Package wsdlgen generates Go source code from wsdl documents.
The wsdlgen package generates Go source for calling the various methods defined in a WSDL (Web Service Definition Language) document. The generated Go source is self-contained, with no dependencies on non-standard packages.
Code generation for the wsdlgen package can be configured by using the provided Option functions.
Index ¶
- Variables
- func GenCLI(args ...string) error
- type Config
- func (cfg *Config) GenAST(files ...string) (*ast.File, error)
- func (cfg *Config) GenCLI(arguments ...string) error
- func (cfg *Config) GenSource(files ...string) ([]byte, error)
- func (cfg *Config) Option(opts ...Option) (previous Option)
- func (cfg *Config) XSDOption(opts ...xsdgen.Option) (previous xsdgen.Option)
- type Logger
- type Option
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = []Option{ PackageName("ws"), InputThreshold(3), OutputThreshold(2), }
DefaultOptions are the default options for Go source code generation.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
A Config contains parameters for the various code generation processes. Users may modify the output of the wsdlgen package's code generation by using a Config's Option method to change these parameters.
func (*Config) GenAST ¶
GenAST creates a Go source file containing type and method declarations that can be used to access the service described in the provided set of wsdl files.
func (*Config) GenCLI ¶
GenCLI creates a file containing Go source generated from a WSDL definition. It is intended to be called from the main function of any command-line interfaces to the wsdlgen package.
func (*Config) GenSource ¶
The GenSource method converts the AST returned by GenAST to formatted Go source code.
type Logger ¶
type Logger interface {
Printf(format string, v ...interface{})
}
Types conforming to the Logger interface can receive information about the code generation process.
type Option ¶
An Option modifies code generation parameters. The return value of an Option can be used to undo its effect.
func InputThreshold ¶
InputThreshold sets the maximum number of parameters a generated function may take. If a WSDL operation is defined as taking greater than n parameters, the generated function will take only one parameter; a struct, through which all arguments will be accessed.
func LogLevel ¶
LogLevel sets the level of verbosity for log messages generated during the code generation process.
func OnlyPorts ¶
The OnlyPorts option defines a whitelist of WSDL ports to generate code for. Any other ports will not have types or methods present in the generated output.
func OutputThreshold ¶
OutputThreshold sets the maximum number of values that a generated function may return. If a WSDL operation is defined as returning greater than n values, the generated function will return a wrapper struct instead. Note that the error value that all generated functions return is not counted against the threshold.
func PackageComment ¶
PackageComment specifies the first line of package-level Godoc comments. If the input WSDL file provides package-level comments, they are added after the provided comment, separated by a newline.
func PackageName ¶
PackageName specifies the name of the generated Go package.