golang

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(pkg string) code.Generator

Types

type Constant

type Constant struct {
	Name  string
	Value string
}

type Constants

type Constants []Constant

func (*Constants) Parse

func (c *Constants) Parse(prog *ast.Program) error

type CustomError

type CustomError struct {
	Name       string
	Code       int64
	HttpStatus string
	Msg        string
}

type CustomErrors

type CustomErrors []CustomError

func (*CustomErrors) Parse

func (c *CustomErrors) Parse(prog *ast.Program) error

type Enum

type Enum struct {
	Name string
	Type string // int8, int16, int32, int64
	Keys []EnumKeyValue
}

type EnumKeyValue

type EnumKeyValue struct {
	Name  string
	Value string
}

type Enums

type Enums []Enum

func (*Enums) Parse

func (e *Enums) Parse(prog *ast.Program) error

type Golang

type Golang struct {
	PkgName      string
	CustomErrors CustomErrors
	Constants    Constants
	Enums        Enums
	Models       Models
	HttpServices HttpServices
	RpcServices  RpcServices
}

func (Golang) HasConstants

func (g Golang) HasConstants() bool

func (Golang) HasHttpServices

func (g Golang) HasHttpServices() bool

func (Golang) HasRpcServices

func (g Golang) HasRpcServices() bool

func (*Golang) Parse

func (g *Golang) Parse(prog *ast.Program) error

type HttpService

type HttpService struct {
	Name    string
	Methods Methods
}

func (HttpService) NameImpl

func (s HttpService) NameImpl() string

func (HttpService) PathName

func (s HttpService) PathName() string

func (HttpService) PathValue

func (s HttpService) PathValue() string

type HttpServices

type HttpServices []HttpService

func (*HttpServices) Parse

func (s *HttpServices) Parse(prog *ast.Program) error

type Method

type Method struct {
	Name    string
	Service string
	Options astutil.MethodOptions
	Args    MethodArgs
	Returns MethodReturns
}

func (Method) ArgsNames

func (m Method) ArgsNames(prefix string) string

func (Method) ArgsNamesValues

func (m Method) ArgsNamesValues() string

func (Method) ArgsStructDefinitions

func (m Method) ArgsStructDefinitions(pointer bool) string

func (Method) GetReturnStreamName

func (m Method) GetReturnStreamName() (string, error)

func (Method) HasArgs

func (m Method) HasArgs() string

func (Method) HasReturns

func (m Method) HasReturns() bool

func (Method) IsBinary

func (m Method) IsBinary() bool

func (Method) IsFileUpload

func (m Method) IsFileUpload() bool

func (Method) IsStream

func (m Method) IsStream() bool

func (Method) PathName

func (m Method) PathName() string

func (Method) PathValue

func (m Method) PathValue() string

func (Method) ReturnStreamType

func (m Method) ReturnStreamType() string

func (Method) ReturnsNames

func (m Method) ReturnsNames(prefix string) string

func (Method) ReturnsStructDefinitions

func (m Method) ReturnsStructDefinitions() string

func (Method) TopicName

func (m Method) TopicName() string

func (Method) TopicValue

func (m Method) TopicValue() string

type MethodArg

type MethodArg struct {
	Name string
	Type string
}

type MethodArgs

type MethodArgs []MethodArg

func (MethodArgs) Definitions

func (m MethodArgs) Definitions() string

type MethodReturn

type MethodReturn struct {
	Name   string
	Type   string
	Stream bool
}

type MethodReturns

type MethodReturns []MethodReturn

func (MethodReturns) Definitions

func (m MethodReturns) Definitions() string

type Methods

type Methods []Method

type Model

type Model struct {
	Name   string
	Fields ModelFields
}

type ModelField

type ModelField struct {
	Name string
	Type string
	Tags string
}

type ModelFields

type ModelFields []ModelField

func (*ModelFields) Parse

func (m *ModelFields) Parse(message *ast.Model, isModelType func(value string) bool) error

type Models

type Models []Model

func (*Models) Parse

func (m *Models) Parse(prog *ast.Program) error

type RpcService

type RpcService struct {
	Name    string
	Methods Methods
}

func (RpcService) TopicName

func (s RpcService) TopicName() string

func (RpcService) TopicValue

func (s RpcService) TopicValue() string

type RpcServices

type RpcServices []RpcService

func (*RpcServices) Parse

func (s *RpcServices) Parse(prog *ast.Program) error

Jump to

Keyboard shortcuts

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