Documentation
¶
Index ¶
- Constants
- func AddController(echoMux *echo.Echo, c Controller)
- func Getwd(path string) string
- func NewLogger() *logger.Logger
- func Version() string
- type CacheConfig
- type Config
- type Controller
- type DatabaseConfig
- type Namespace
- type Orm
- type PongorOption
- type Renderer
- type Ripple
- func (this *Ripple) GetCache(alias string) *cache.Cache
- func (this *Ripple) GetConfig() *Config
- 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) Run()
Constants ¶
const VersionName = "0.5.9"
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.
Types ¶
type CacheConfig ¶
type CacheConfig struct {
Alias string `json:"alias"` // alias=forum
Section string `json:"section"` // section=forum
Adapter string `json:"adapter"` // adapter=redis
Host string `json:"host"` // host=127.0.0.1
Port int `json:"port"` // port=6379
Password string `json:"password"` // password=123456
}
func (CacheConfig) GetCacheAdapterConfig ¶
func (cacheConfig CacheConfig) GetCacheAdapterConfig() cache.AdapterConfig
GetCacheConfig return cache config
type Config ¶
type Config struct {
DebugOn bool `json:"debugOn"` // debugOn
AutoMigrate bool `json:"autoMigrate"` // autoMigrate
Domain string `json:"domain"` // domain=127.0.0.1:8090
Static string `json:"static"` // static=frontend/static
Templates string `json:"templates"` // templates=frontend/templates
Databases []DatabaseConfig `json:"databases,omitempty"` // databases
Caches []CacheConfig `json:"caches,omitempty"` // caches
}
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 `json:"alias"` // alias=forum
Dialect string `json:"dialect"` // dialect=mysql
Host string `json:"host"` // host=127.0.0.1
Port int `json:"port"` // port=3306
Name string `json:"name"` // name=forum
Username string `json:"username"` // username=root
Password string `json:"password"` // password=123456
}
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 *Config, options ...PongorOption) *Renderer
type Ripple ¶
type Ripple struct {
Logger *logger.Logger
Echo *echo.Echo
Config *Config
Orms map[string]*Orm
Caches map[string]*cache.Cache
}
Ripple ripple struct
func (*Ripple) GetEcho ¶ added in v0.5.8
================================================================
Ripple func
================================================================ GetEcho return echo
func (*Ripple) RegisterController ¶ added in v0.5.8
func (this *Ripple) RegisterController(c Controller)
RegisterControllers register a controller for ripple App
func (*Ripple) RegisterModels ¶ added in v0.5.8
RegisterModels registers models in the global ripple App.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
ripple
command
|
|
|
ripple/templates
command
|
|
|
fixtures
|
|
|
forum
command
|
|
|
middleware
|
|