definition

package
v3.1.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServiceDescriperBuild

func ServiceDescriperBuild(serviceName string, group string, version string) string

ServiceDescriperBuild builds the service key, format is `group/serviceName:version` which be same as URL's service key

Types

type FullServiceDefinition

type FullServiceDefinition struct {
	Parameters map[string]string `json:"parameters"`
	ServiceDefinition
}

FullServiceDefinition is the describer of service definition with parameters

func BuildFullDefinition added in v3.0.4

func BuildFullDefinition(service common.Service, url *common.URL) *FullServiceDefinition

BuildFullDefinition can build service definition with full url parameters

func (*FullServiceDefinition) String added in v3.0.4

func (def *FullServiceDefinition) String() string

String will iterate all methods and parameters and convert them to json string

func (*FullServiceDefinition) ToBytes added in v3.0.4

func (def *FullServiceDefinition) ToBytes() ([]byte, error)

ToBytes convert ServiceDefinition to json string

type MethodDefinition

type MethodDefinition struct {
	Name           string           `json:"name"`
	ParameterTypes []string         `json:"parameterTypes"`
	ReturnType     string           `json:"returnType"`
	Parameters     []TypeDefinition `json:"parameters"`
}

MethodDefinition is the describer of method definition

type ServiceDefiner

type ServiceDefiner interface {
	ToBytes() ([]byte, error)
}

ServiceDefiner is a interface of service's definition

type ServiceDefinition

type ServiceDefinition struct {
	CanonicalName string             `json:"canonicalName"`
	CodeSource    string             `json:"codeSource"`
	Methods       []MethodDefinition `json:"methods"`
	Types         []TypeDefinition   `json:"types"`
}

ServiceDefinition is the describer of service definition

func BuildServiceDefinition

func BuildServiceDefinition(service common.Service, url *common.URL) *ServiceDefinition

BuildServiceDefinition can build service definition which will be used to describe a service

func (*ServiceDefinition) String

func (def *ServiceDefinition) String() string

String will iterate all methods and parameters and convert them to json string

func (*ServiceDefinition) ToBytes

func (def *ServiceDefinition) ToBytes() ([]byte, error)

ToBytes convert ServiceDefinition to json string

type TypeDefinition

type TypeDefinition struct {
	ID              string                    `json:"id"`
	Type            string                    `json:"type"`
	Items           []TypeDefinition          `json:"items"`
	Enums           []string                  `json:"enums"`
	Properties      map[string]TypeDefinition `json:"properties"`
	TypeBuilderName string                    `json:"typeBuilderName"`
}

TypeDefinition is the describer of type definition

type User

type User struct {
	ID   string
	Name string
	Age  int32
	Time time.Time
}

func (User) JavaClassName

func (u User) JavaClassName() string

type UserProvider

type UserProvider struct{}

func (*UserProvider) GetUser

func (u *UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error)

func (*UserProvider) Reference

func (u *UserProvider) Reference() string

Jump to

Keyboard shortcuts

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