Documentation ¶
Index ¶
- Constants
- func AddController(echoMux *echo.Echo, c Controller)
- func GetConfig() *viper.Viper
- func GetEnv() string
- func InitConfig(env string)
- func InitConfigWithPath(env string, configPath string)
- func NewLog(item LogConfig) *logrus.Logger
- func NewLogger() *logger.Logger
- func NewRpcServerNacos(nacos NacosConfig) (*server.Server, *serverplugin.NacosRegisterPlugin)
- func RunScript(commands []string)
- func Version() string
- type BaseConfig
- type CacheConfig
- type ClsConfig
- type Controller
- type DatabaseConfig
- type LogConfig
- type LogType
- type NacosConfig
- type Namespace
- type Orm
- type PongorOption
- type Renderer
- type Ripple
- func (this *Ripple) AddLogType(value LogType)
- func (this *Ripple) CloseCache()
- func (this *Ripple) CloseOrm()
- func (this *Ripple) GetCache(alias string) *cache.Cache
- func (this *Ripple) GetEcho() *echo.Echo
- func (this *Ripple) GetLog(alias string) *logrus.Logger
- func (this *Ripple) GetOrm(alias string) *Orm
- func (this *Ripple) RegisterController(c Controller)
- func (this *Ripple) RegisterModels(orm *Orm, modelItems ...interface{})
- func (this *Ripple) RegisterRpc(name string, rpc interface{}, metadata string)
- func (this *Ripple) Run()
- func (this *Ripple) RunRpc()
- func (this *Ripple) RunWith(domain string)
- func (this *Ripple) StopRpc()
- func (this *Ripple) UnregisterRpc()
- type SlsConfig
Constants ¶
const ( LogTypeSLS = "sls" LogTypeCLS = "cls" )
const VersionName = "1.3.4"
VersionName 0.8.2以后使用yaml配置文件, 1.0.1升级了脚手架(protoc, ast gen)
Variables ¶
This section is empty.
Functions ¶
func AddController ¶
func AddController(echoMux *echo.Echo, c Controller)
AddControllers applies the Controller to the echo via a new Group using the Controller's ripple tags as a manifest to properly associate methods/path and handler.
func InitConfig ¶ added in v0.7.0
func InitConfig(env string)
func InitConfigWithPath ¶ added in v0.8.7
func NewRpcServerNacos ¶ added in v0.8.6
func NewRpcServerNacos(nacos NacosConfig) (*server.Server, *serverplugin.NacosRegisterPlugin)
NewRpcServerNacos create rpc server
Types ¶
type BaseConfig ¶ added in v0.7.0
type BaseConfig struct { AutoMigrate bool `mapstructure:"autoMigrate,omitempty"` // autoMigrate BindAllTag bool `mapstructure:"bindAllTag,omitempty"` // false=binding Debug bool `mapstructure:"debug,omitempty"` // debug, default false Domain string `mapstructure:"domain,omitempty"` // domain=127.0.0.1:8090 Static string `mapstructure:"static,omitempty"` // static=frontend/static Templates string `mapstructure:"templates,omitempty"` // templates=frontend/templates Databases []DatabaseConfig `mapstructure:"databases,omitempty"` // databases Caches []CacheConfig `mapstructure:"caches,omitempty"` // caches Logs []LogConfig `mapstructure:"logs,omitempty"` // logs Nacos NacosConfig `mapstructure:"nacos,omitempty"` // nacos SLS SlsConfig `mapstructure:"sls,omitempty"` // sls CLS ClsConfig `mapstructure:"cls,omitempty"` // cls }
func GetBaseConfig ¶ added in v0.7.0
func GetBaseConfig() *BaseConfig
type CacheConfig ¶
type CacheConfig struct { Alias string `mapstructure:"alias"` // alias=forum Section string `mapstructure:"section"` // section=forum Adapter string `mapstructure:"adapter"` // adapter=redis Host string `mapstructure:"host"` // host=127.0.0.1 Port int `mapstructure:"port"` // port=6379 Password string `mapstructure:"password"` // password=123456 DB int `mapstructure:"db"` // db, select db PoolSize int `mapstructure:"poolSize"` // poolSize MinIdleConns int `mapstructure:"minIdleConns"` // minIdleConns }
func (CacheConfig) GetCacheAdapterConfig ¶
func (cacheConfig CacheConfig) GetCacheAdapterConfig() cache.AdapterConfig
type ClsConfig ¶ added in v1.1.5
type ClsConfig struct { AccessKeyId string `mapstructure:"accessKeyId"` AccessKeySecret string `mapstructure:"accessKeySecret"` Endpoint string `mapstructure:"endpoint"` AllowLogLevel string `mapstructure:"allowLogLevel"` CloseStdout bool `mapstructure:"closeStdout"` Topic string `mapstructure:"topic"` }
type Controller ¶
type Controller interface { // Path is the namespace ripple will create the Group at, eg /posts Path() string }
Controller is the interface for a Controller to be applied to an echo Group
type DatabaseConfig ¶
type DatabaseConfig struct { Alias string `mapstructure:"alias"` // alias=forum Dialect string `mapstructure:"dialect"` // dialect=mysql Host string `mapstructure:"host"` // host=127.0.0.1 Port int `mapstructure:"port"` // port=3306 Name string `mapstructure:"name"` // name=forum Username string `mapstructure:"username"` // username=root Password string `mapstructure:"password"` // password=123456 MaxIdleConns int `mapstructure:"maxIdleConns"` // maxIdleConns MaxOpenConns int `mapstructure:"maxOpenConns"` // maxOpenConns }
type LogConfig ¶ added in v1.2.7
type LogConfig struct { Alias string `mapstructure:"alias"` Type string `mapstructure:"type"` // sls, cls AccessKeyId string `mapstructure:"accessKeyId"` AccessKeySecret string `mapstructure:"accessKeySecret"` Endpoint string `mapstructure:"endpoint"` AllowLogLevel string `mapstructure:"allowLogLevel"` CloseStdout bool `mapstructure:"closeStdout"` Project string `mapstructure:"project"` Logstore string `mapstructure:"logstore"` Topic string `mapstructure:"topic"` Source string `mapstructure:"source"` }
type NacosConfig ¶ added in v1.1.5
type NacosConfig struct { // common Host string `mapstructure:"host"` Port uint64 `mapstructure:"port"` NamespaceId string `mapstructure:"namespaceId"` Cluster string `mapstructure:"cluster"` Group string `mapstructure:"group"` CacheDir string `mapstructure:"cacheDir"` LogDir string `mapstructure:"logDir"` // server Server string `mapstructure:"server"` // client FailMode string `mapstructure:"failMode"` SelectMode string `mapstructure:"selectMode"` ClientPoolSize int `mapstructure:"clientPoolSize"` }
type Namespace ¶
type Namespace string
===========================Namespace================================= Namespace provides an embeddable type that will allow a struct to implement Controller.
type Orm ¶
Orm facilitate database interactions, support mysql
func NewOrm ¶
func NewOrm(database DatabaseConfig, debug bool) *Orm
NewOrm creates a new model, and opens database connection based on cfg settings
func (*Orm) AutoMigrateAll ¶
func (orm *Orm) AutoMigrateAll()
AutoMigrateAll runs migrations for all the registered models
type PongorOption ¶
type Renderer ¶
type Renderer struct { PongorOption // contains filtered or unexported fields }
func NewRenderer ¶
func NewRenderer(config *BaseConfig, options ...PongorOption) *Renderer
type Ripple ¶
type Ripple struct { Logger *logger.Logger Logrus *logrus.Logger Echo *echo.Echo Orms map[string]*Orm Caches map[string]*cache.Cache Logs map[string]*logrus.Logger RpcServer *server.Server NacosRegisterPlugin *serverplugin.NacosRegisterPlugin }
Ripple ripple struct
func (*Ripple) AddLogType ¶ added in v1.1.6
AddLogType add log type (ripple.LogTypeSLS, ripple.LogTypeCLS)
func (*Ripple) CloseCache ¶ added in v1.2.1
func (this *Ripple) CloseCache()
func (*Ripple) GetEcho ¶ added in v0.5.8
func (this *Ripple) GetEcho() *echo.Echo
GetEcho return echo
func (*Ripple) RegisterController ¶ added in v0.5.8
func (this *Ripple) RegisterController(c Controller)
RegisterController register a controller for ripple App
func (*Ripple) RegisterModels ¶ added in v0.5.8
RegisterModels registers models in the global ripple App.
func (*Ripple) RegisterRpc ¶ added in v0.8.6
RegisterRpc register rpc service
func (*Ripple) StopRpc ¶ added in v1.2.1
func (this *Ripple) StopRpc()
StopRpc stop rpc server, close all rpc connections
func (*Ripple) UnregisterRpc ¶ added in v0.8.6
func (this *Ripple) UnregisterRpc()
UnregisterRpc unregisters all rpc services.
type SlsConfig ¶ added in v1.1.5
type SlsConfig struct { AccessKeyId string `mapstructure:"accessKeyId"` AccessKeySecret string `mapstructure:"accessKeySecret"` Endpoint string `mapstructure:"endpoint"` AllowLogLevel string `mapstructure:"allowLogLevel"` CloseStdout bool `mapstructure:"closeStdout"` Project string `mapstructure:"project"` Logstore string `mapstructure:"logstore"` Topic string `mapstructure:"topic"` Source string `mapstructure:"source"` }
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
fixtures
|
|
middleware
|
|
nacos
|
|
nacos-sdk-go/v2/clients/naming_client/naming_proxy
Package naming_proxy is a generated GoMock package.
|
Package naming_proxy is a generated GoMock package. |
nacos-sdk-go/v2/common/http_agent
* Copyright 1999-2020 Alibaba Group Holding Ltd.
|
* Copyright 1999-2020 Alibaba Group Holding Ltd. |
nacos-sdk-go/v2/inner/uuid
Package uuid provides implementation of Universally Unique Identifier (UUID).
|
Package uuid provides implementation of Universally Unique Identifier (UUID). |
nacos-sdk-go/v2/mock
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |
protoc
|
|