config

package
v0.0.0-...-6515077 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTemplateNotFound = errors.New("template not found")
View Source
var GORPCCliVersion string = "22f5bbb"

Functions

func CheckDependencies

func CheckDependencies(deps []Dependency) error

CheckDependencies check if dependencies meet the version requirements

func GetLocale

func GetLocale() (string, error)

func InstallTemplate

func InstallTemplate(installTo string) error

func LoadTranslation

func LoadTranslation(messageID string, data map[string]interface{}) string

LoadTranslation 加载对应当前locale的消息

func LocateTemplatePath

func LocateTemplatePath() (string, error)

LocateTemplatePath locate where templates are installed

func TemplateInstallPath

func TemplateInstallPath(dirs []string) (dir string, err error)

TemplateInstallPath 确定一个有效的模板路径

func TemplateSearchPaths

func TemplateSearchPaths() (dirs []string, err error)

TemplateSearchPaths 获取gorpc安装路径 root安装到/etc/gorpc,非root用户安装到$HOME/.gorpc

Types

type Dependency

type Dependency struct {
	Executable string `json:"executable"`  // name of Dependency
	VersionMin string `json:"version_min"` // minimum version, a.b.c
	VersionCmd string `json:"version_cmd"` // cmd to get version
	InstallCmd string `json:"install_cmd"` // cmd to install
	Fallback   string `json:"fallback"`    // fallback message
}

Dependency describes a Dependency

func LoadDependencies

func LoadDependencies() ([]Dependency, error)

LoadDependencies load dependencies and version requirements

func (*Dependency) CheckVersion

func (d *Dependency) CheckVersion() (passed bool, err error)

func (*Dependency) Install

func (d *Dependency) Install() error

func (*Dependency) Installed

func (d *Dependency) Installed() (bool, error)

check installed or not

func (*Dependency) Version

func (d *Dependency) Version() (string, error)

type TemplateCfg

type TemplateCfg struct {
	AssetDir          string   `json:"asset_dir"`            // required: 语言对应的模板工程目录,如asset_go
	LangFileExt       string   `json:"lang_file_ext"`        // required: 文件扩展名,如.go
	TplFileExt        string   `json:"tpl_file_ext"`         // required: 工程中模板文件的后缀名,如.tpl
	RPCServerStub     string   `json:"rpc_server_stub"`      // optional: 工程中对应的rpc server stub文件名(按service.method分文件生成时有用)
	RPCServerImplStub string   `json:"rpc_server_impl_stub"` // optional: 工程中对应的rpc server impl stub文件名(按service.method分文件生成时有用)
	RPCServerTestStub string   `json:"rpc_server_test_stub"` // optional: 工程中对应的rpc server stub测试文件名(按service.method分文件生成时有用)
	RPCClientStub     []string `json:"rpc_client_stub"`      // required: 工程中对应的rpc client stub文件列表
}

TemplateCfg 开发语言相关的配置信息,如对应的模板工程目录、模板工程中的serverstub文件、clientstub文件

func GetTemplateCfg

func GetTemplateCfg() (*TemplateCfg, error)

GetTemplateCfg 加载开发语言对应的配置信息

Jump to

Keyboard shortcuts

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