data

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2022 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPort = 8910
View Source
const DiscoverBasePath = "/es_rpc"
View Source
const ESConfigPath = "esconfig"
View Source
const ESKeyFileExt = ".eskey"
View Source
const ESVersion = 79

Variables

View Source
var DefaultConfigs = []string{"es.yml", "es.json"}

Functions

func FileExist added in v1.1.0

func FileExist(path string) bool

func GetAppPath added in v1.1.0

func GetAppPath() string

GetAppPath 获取程序运行路径

func GetPwdPath added in v1.1.0

func GetPwdPath() string

GetPwdPath 获取启动指令的执行目录

func SearchFile added in v1.1.0

func SearchFile(path string) (string, error)

Types

type ESConfig

type ESConfig struct {
	Port     int    `default:"8910"` //服务端口,默认端口8910
	Name     string //系统中的nodename用于区分不同服务
	Key      string //链接密钥,用于链接到整个系统中
	Consul   string `required:"true"` //consul发现服务
	Endpoint string //访问端点,如果配置,服务启动时会使用访问端点向etcd进行注册,其他服务会通过此访问端点来访问此服务
}

ESConfig 配置文件映射结构

func GetConfig

func GetConfig(configFile ...string) (*ESConfig, error)

type ESKey

type ESKey struct {
	Name string `json:"name"` // NodeName
	Key  string `json:"key"`  // 密钥
}

ESKey 密钥文件映射结构,索引服务配置文件目录需要增加相应客户端的密码,客户端才可以连

type MethodInfo

type MethodInfo struct {
	MethodName  string   //方法名
	ParamsType  []string //每个参数类型
	ReturnsType []string // 方法返回参数的类型
}

MethodInfo 方法信息

type NodeInfo

type NodeInfo struct {
	NodeName  string                  //节点名称
	ESVersion int                     // 存储es的版本号
	Services  map[string]*ServiceInfo // 当前节点包含的服务
}

NodeInfo 节点信息

type Request

type Request struct {
	NodeName   string   // 节点名称
	Path       string   //服务包路径
	Method     string   //服务名
	Parameters [][]byte //调用参数
}

Request 调用服务的时候发出去的数据

func (*Request) AddParameter

func (r *Request) AddParameter(parameter interface{}) error

func (*Request) SetParameters

func (r *Request) SetParameters(parameter ...interface{}) error

type Result

type Result struct {
	Binary   [][]byte  // 方法返回的数据
	NodeINfo *NodeInfo //节点信息
}

Result 服务执行结果

func NewResult

func NewResult(vs []reflect.Value) (*Result, error)

func (*Result) AddData

func (r *Result) AddData(typeValue reflect.Value) error

AddData 增加数据

func (*Result) GetData

func (r *Result) GetData() [][]byte

func (*Result) GetResult

func (r *Result) GetResult(function interface{}) error

GetResult 利用回调方法获取数据

func (*Result) SetData

func (r *Result) SetData(data [][]byte)

type ServiceInfo

type ServiceInfo struct {
	Path    string                 //服务对象(结构)路径
	Methods map[string]*MethodInfo // 服务提供的方法
}

ServiceInfo 服务信息

Jump to

Keyboard shortcuts

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