Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when an Object is not found.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct {
// PackageName is the name of the package.
PackageName string `json:"packageName"`
// Services are the services described in this definition.
Services []Service `json:"services"`
// Objects are the structures that are used throughout this definition.
Objects []Object `json:"objects"`
// Imports is a map of Go imports that should be imported into
// Go code.
Imports map[string]string `json:"imports"`
}
Definition describes an definition.
func (*Definition) Object ¶
func (d *Definition) Object(name string) (*Object, error)
Object looks up an object by name. Returns ErrNotFound error if it cannot find it.
func (*Definition) ObjectIsInput ¶
func (d *Definition) ObjectIsInput(name string) bool
ObjectIsInput gets whether this object is a method input (request) type or not. Returns true if any method.InputObject.ObjectName matches name.
func (*Definition) ObjectIsOutput ¶
func (d *Definition) ObjectIsOutput(name string) bool
ObjectIsOutput gets whether this object is a method output (response) type or not. Returns true if any method.OutputObject.ObjectName matches name.
type Field ¶
type Field struct {
Name string `json:"name"`
Type FieldType `json:"type"`
Comment string `json:"comment"`
Tag string `json:"tag"`
ParsedTags map[string]FieldTag `json:"parsedTags"`
}
Field describes the field inside an Object.
type FieldTag ¶
type FieldTag struct {
// Value is the value of the tag.
Value string `json:"value"`
// Options are the options for the tag.
Options []string `json:"options"`
}
FieldTag is a parsed tag. For more information, see Struct Tags in Go.
type FieldType ¶
type FieldType struct {
TypeID string `json:"typeID"`
TypeName string `json:"typeName"`
ObjectName string `json:"objectName"`
// CleanObjectName is the ObjectName with * removed
// for pointer types.
CleanObjectName string `json:"cleanObjectName"`
Multiple bool `json:"multiple"`
Package string `json:"package"`
IsObject bool `json:"isObject"`
}
FieldType holds information about the type of data that this Field stores.
type Method ¶
type Method struct {
Name string `json:"name"`
InputObjects []FieldType `json:"inputObjects"`
OutputObjects []FieldType `json:"outputObjects"`
Comment string `json:"comment"`
}
Method describes a method that a Service can perform.
type Object ¶
type Object struct {
TypeID string `json:"typeID"`
Name string `json:"name"`
Imported bool `json:"imported"`
Fields []Field `json:"fields"`
Comment string `json:"comment"`
}
Object describes a data structure that is part of this definition.
type Parser ¶
type Parser struct {
Verbose bool
ExcludeInterfaces []string
// contains filtered or unexported fields
}
Parser parses packages.