api

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	ServiceName string                    `json:"name"`
	Operators   map[string]*OperatorGroup `json:"operators"`
	Models      map[string]*OperatorModel `json:"models"`
	Enums       map[string]Enum           `json:"enums"`
}

func NewApi

func NewApi() Api

func (*Api) AddEnum

func (a *Api) AddEnum(id string, e Enum)

func (*Api) AddGroup

func (a *Api) AddGroup(name string) *OperatorGroup

func (*Api) AddModel

func (a *Api) AddModel(model *OperatorModel)

func (*Api) GetGroup

func (a *Api) GetGroup(name string) *OperatorGroup

func (*Api) WalkOperators

func (a *Api) WalkOperators(walker func(g *OperatorGroup))

type Enum

type Enum enumeration.Enum

func (Enum) Labels

func (enum Enum) Labels() (labels []string)

func (Enum) Sort

func (enum Enum) Sort() Enum

func (Enum) Vals

func (enum Enum) Vals() (vals []interface{})

func (Enum) Values

func (enum Enum) Values() (values []interface{})

type OperatorField

type OperatorField struct {
	Key     string `json:"key"`
	Type    string `json:"type"`
	Tag     string `json:"tag"`
	Alias   string `json:"alias"`
	Imports string `json:"imports"`
	Pointer bool   `json:"pointer"`
}

type OperatorGroup

type OperatorGroup struct {
	Name    string                     `json:"name"`
	Path    string                     `json:"path"`
	Methods map[string]*OperatorMethod `json:"methods"`
	IsPush  bool                       `json:"isPush"`
}

func NewOperatorGroup

func NewOperatorGroup(name, path string) *OperatorGroup

func (*OperatorGroup) AddMethod

func (g *OperatorGroup) AddMethod(method *OperatorMethod)

func (*OperatorGroup) AddMethods

func (g *OperatorGroup) AddMethods(methods ...*OperatorMethod)

func (*OperatorGroup) WalkMethods

func (g *OperatorGroup) WalkMethods(walker func(m *OperatorMethod))

type OperatorMethod

type OperatorMethod struct {
	Group   *OperatorGroup `json:"-"`
	Name    string         `json:"name"`
	Path    string         `json:"path"`
	Inputs  []string       `json:"inputs"`
	Outputs []string       `json:"outputs"`
}

func NewOperatorMethod

func NewOperatorMethod(group *OperatorGroup, name, path string) *OperatorMethod

func (*OperatorMethod) AddInput

func (m *OperatorMethod) AddInput(model *OperatorModel)

func (*OperatorMethod) AddOutput

func (m *OperatorMethod) AddOutput(model *OperatorModel)

func (*OperatorMethod) WalkInputs

func (m *OperatorMethod) WalkInputs(walker func(i string))

func (*OperatorMethod) WalkOutputs

func (m *OperatorMethod) WalkOutputs(walker func(i string))

type OperatorModel

type OperatorModel struct {
	ID        string          `json:"id"`
	Name      string          `json:"name"`
	Package   string          `json:"package"`
	Fields    []OperatorField `json:"fields,omitempty"`
	NeedAlias bool            `json:"needAlias"`
}

func NewOperatorModel

func NewOperatorModel(name string, pkgID string) OperatorModel

func NewTimeModel

func NewTimeModel() OperatorModel

func (*OperatorModel) AddField

func (m *OperatorModel) AddField(key, keyType, tag, alias, ipt string, pointer bool)

func (*OperatorModel) WalkFields

func (m *OperatorModel) WalkFields(walker func(f OperatorField))

Jump to

Keyboard shortcuts

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