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 NewLogger() *logger.Logger
- func NewRpcServerNacos(nacos Nacos) *server.Server
- func RunScript(commands []string)
- func Version() string
- type BaseConfig
- type CacheConfig
- type Controller
- type DatabaseConfig
- type Nacos
- type Namespace
- type Orm
- type PongorOption
- type Renderer
- type Ripple
- func (this *Ripple) GetCache(alias string) *cache.Cache
- func (this *Ripple) GetEcho() *echo.Echo
- 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) UnregisterRpc()
Constants ¶
const VersionName = "1.0.7"
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
NewRpcServerNacos create rpc server
Types ¶
type BaseConfig ¶ added in v0.7.0
type BaseConfig struct { AutoMigrate bool `mapstructure:"autoMigrate,omitempty"` // autoMigrate 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 Nacos Nacos `mapstructure:"nacos,omitempty"` // nacos }
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 }
func (CacheConfig) GetCacheAdapterConfig ¶
func (cacheConfig CacheConfig) GetCacheAdapterConfig() cache.AdapterConfig
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 Nacos ¶ added in v0.8.6
type Nacos struct { 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 string `mapstructure:"server"` }
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 Echo *echo.Echo Orms map[string]*Orm Caches map[string]*cache.Cache RpcServer *server.Server }
Ripple ripple struct
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) UnregisterRpc ¶ added in v0.8.6
func (this *Ripple) UnregisterRpc()
UnregisterRpc unregisters all rpc services.