gen

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2016 License: Apache-1.1 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetImportPathRoot

func GetImportPathRoot() string

GetImportPathRoot returns the root path to use in import statements. The root path is determined by stripping "$GOPATH/src/" from the current working directory. For example, when generating code within the QuickFIX/Go source tree, the returned root path will be "github.com/quickfixgo/quickfix".

func HeaderTrailerPkg

func HeaderTrailerPkg(pkg string) string

func WriteComponentImports

func WriteComponentImports(writer io.Writer, pkg string, parts []datadictionary.MessagePart) error

func WriteFieldDeclarations

func WriteFieldDeclarations(fixSpecMajor int, fixSpecMinor int, parts []datadictionary.MessagePart, componentName string) (s string)

func WriteFieldSetters

func WriteFieldSetters(writer io.Writer, receiver string, parts []datadictionary.MessagePart) error

WriteFieldSetters generates setters appropriate for Messages, Components or Repeating Groups

func WriteFile

func WriteFile(filePath, fileOut string) error

WriteFile parses the generated code in fileOut and writes the code out to filePath. Function performs some import clean up and gofmts the code before writing Returns ParseError if the generated source is invalid but is written to filePath

func WriteGroupDeclaration

func WriteGroupDeclaration(fixSpecMajor, fixSpecMinor int, field *datadictionary.FieldDef, parent string) (fileOut string)

func WriteMessageImports

func WriteMessageImports(writer io.Writer, pkg string, parts []datadictionary.MessagePart) error

func WriteNewComponent

func WriteNewComponent(writer io.Writer, comp datadictionary.ComponentType) error

func WriteNewMessage

func WriteNewMessage(writer io.Writer, msg datadictionary.MessageDef) error

func WritePackage

func WritePackage(writer io.Writer, pkg string) error

Types

type ErrorHandler

type ErrorHandler struct {
	ReturnCode int
}

ErrorHandler is a convenience struct for interpretting generation Errors

func (*ErrorHandler) Handle

func (h *ErrorHandler) Handle(err error)

Handle interprets the generation error. Proceeds with setting returnCode, or panics depending on error type

type ParseError

type ParseError struct {
	// contains filtered or unexported fields
}

ParseError indicates generated go source is invalid

func (ParseError) Error

func (e ParseError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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