definition

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Definition

type Definition struct {
	Services       []Service `json:"services"`
	PackageName    string    `json:"packageName"`
	PackageComment string    `json:"packageComment"`
}

Definition is the definition of one or more services. In templates, it is usually accessed via the `def` variable.

Package name is <%= def.PackageName %>

func (Definition) Source

func (d Definition) Source() string

Source gets the Remoto source for this definition.

func (Definition) String

func (d Definition) String() string

func (Definition) Structure

func (d Definition) Structure(name string) *Structure

Structure gets a Structure by name.

func (Definition) Valid

func (d Definition) Valid() error

Valid gets whether this Definition is valid or not.

type Field

type Field struct {
	Name    string `json:"name"`
	Comment string `json:"comment"`
	Type    Type   `json:"type"`
}

Field describes a structure field.

func (Field) IsExported

func (f Field) IsExported() bool

IsExported gets whether the field is exported or not.

func (Field) String

func (f Field) String() string

type Method

type Method struct {
	Name              string    `json:"name"`
	Comment           string    `json:"comment"`
	RequestStructure  Structure `json:"requestStructure"`
	ResponseStructure Structure `json:"responseStructure"`
}

Method is a single method.

func (Method) String

func (m Method) String() string

type Service

type Service struct {
	Name       string      `json:"name"`
	Comment    string      `json:"comment"`
	Methods    []Method    `json:"methods"`
	Structures []Structure `json:"structures"`
}

Service describes a logically grouped set of endpoints.

func (*Service) EnsureStructure

func (s *Service) EnsureStructure(structure Structure)

EnsureStructure adds the Structure to the service if it isn't already there.

func (Service) String

func (s Service) String() string

type Structure

type Structure struct {
	Name       string  `json:"name"`
	Comment    string  `json:"comment"`
	Fields     []Field `json:"fields"`
	IsImported bool    `json:"isImported"`

	IsRequestObject  bool `json:"isRequestObject"`
	IsResponseObject bool `json:"isResponseObject"`
}

Structure describes a data structure.

func (Structure) FieldsOfType

func (s Structure) FieldsOfType(typename string) []Field

FieldsOfType gets all Field objects that have a specific type.

func (Structure) HasField

func (s Structure) HasField(field string) bool

HasField gets whether the Structure has a specific field or not.

func (Structure) HasFields

func (s Structure) HasFields() bool

HasFields gets whether the Structure has any fields or not.

func (Structure) String

func (s Structure) String() string

type Type

type Type struct {
	Name       string `json:"name"`
	IsMultiple bool   `json:"isMultiple"`
	IsStruct   bool   `json:"isStruct"`
	IsImported bool   `json:"isImported"`
}

Type describes the type of a Field.

Jump to

Keyboard shortcuts

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