Documentation
¶
Index ¶
- func Booting(f func(Initiator))
- func ConvertAssign(dest, src interface{}) error
- func InSlice(array interface{}, item interface{}) bool
- type Application
- func (app *Application) AsyncCachePreheat(f func(repo *Repository))
- func (app *Application) BindComponent(single bool, com interface{})
- func (app *Application) BindController(relativePath string, controller interface{}, service ...interface{})
- func (app *Application) BindControllerByParty(party iris.Party, controller interface{}, service ...interface{})
- func (app *Application) BindRepository(f interface{})
- func (app *Application) BindService(f interface{})
- func (app *Application) CachePreheat(f func(repo *Repository))
- func (app *Application) CreateH2CRunner(addr string) iris.Runner
- func (app *Application) CreateParty(relativePath string, handlers ...context.Handler) iris.Party
- func (app *Application) GetComponent(ctx iris.Context, com interface{})
- func (app *Application) GetService(ctx iris.Context, service interface{})
- func (app *Application) InjectController(f interface{})
- func (app *Application) InstallGorm(f func() (db *gorm.DB, cache gcache.Plugin))
- func (app *Application) InstallMiddleware(handler iris.Handler)
- func (app *Application) InstallRedis(f func() (client *redis.Client))
- func (app *Application) Iris() *iris.Application
- func (app *Application) Logger() *golog.Logger
- func (app *Application) Run(serve iris.Runner, irisConf iris.Configuration)
- type BeginRequest
- type Bus
- type Component
- func (c *Component) AddBus(key string, component interface{})
- func (c *Component) BeginRequest(rt Runtime)
- func (c *Component) DB() (db *gorm.DB)
- func (c *Component) DBCache() gcache.Plugin
- func (c *Component) GetBus() *Bus
- func (c *Component) NewFastRequest(url string) Request
- func (c *Component) NewH2CRequest(url string) Request
- func (c *Component) Redis() *redis.Client
- type ComponentPool
- type GORMRepository
- type Initiator
- type JMap
- func (jm *JMap) AllKey() []interface{}
- func (jm *JMap) DelAll()
- func (jm *JMap) Exist(key interface{}) bool
- func (jm *JMap) Get(key interface{}, value interface{}) error
- func (jm *JMap) Interface(key interface{}) interface{}
- func (jm *JMap) Remove(key interface{})
- func (jm *JMap) Set(key interface{}, value interface{})
- func (jm *JMap) SetOrStore(key interface{}, value interface{}) (v interface{}, set bool)
- type Limiter
- type Logger
- type Pager
- type Prometheus
- type QueryBuilder
- type Reorder
- type Repository
- func (repo *Repository) BeginRequest(rt Runtime)
- func (repo *Repository) DB() (db *gorm.DB)
- func (repo *Repository) DBCache() gcache.Plugin
- func (repo *Repository) NewAscOrder(field string, fields ...string) *Reorder
- func (repo *Repository) NewDescOrder(field string, fields ...string) *Reorder
- func (repo *Repository) NewFastRequest(url string) Request
- func (repo *Repository) NewH2CRequest(url string) Request
- func (repo *Repository) Redis() *redis.Client
- func (repo *Repository) Transaction(fun func() error) (e error)
- type RepositoryPool
- type Request
- type Runtime
- type Scanner
- type ServicePool
- type Store
- func (s *Store) Exist(key interface{}) bool
- func (s *Store) Get(key interface{}, value interface{}) error
- func (s *Store) Keys() []interface{}
- func (s *Store) Remove(key interface{})
- func (s *Store) RemoveAll()
- func (s *Store) Set(key interface{}, value interface{})
- func (s *Store) SetOrStore(key interface{}, value interface{}) (v interface{}, set bool)
- func (s *Store) ToInterface(key interface{}) interface{}
- func (s *Store) ToMap() map[interface{}]interface{}
- func (s *Store) Values() []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Booting ¶
func Booting(f func(Initiator))
Booting app.BindController or app.BindControllerByParty.
func ConvertAssign ¶
func ConvertAssign(dest, src interface{}) error
Types ¶
type Application ¶
type Application struct {
IrisApp *iris.Application
Database struct {
Install func() (db *gorm.DB, cache gcache.Plugin)
// contains filtered or unexported fields
}
Redis struct {
Install func() (client *redis.Client)
// contains filtered or unexported fields
}
Middleware []context.Handler
Prometheus *Prometheus
ControllerDep []interface{}
// contains filtered or unexported fields
}
Application .
func (*Application) AsyncCachePreheat ¶
func (app *Application) AsyncCachePreheat(f func(repo *Repository))
AsyncCachePreheat .
func (*Application) BindComponent ¶ added in v0.0.4
func (app *Application) BindComponent(single bool, com interface{})
BindComponent .
func (*Application) BindController ¶
func (app *Application) BindController(relativePath string, controller interface{}, service ...interface{})
BindController .
func (*Application) BindControllerByParty ¶
func (app *Application) BindControllerByParty(party iris.Party, controller interface{}, service ...interface{})
BindControllerByParty .
func (*Application) BindRepository ¶
func (app *Application) BindRepository(f interface{})
BindRepository .
func (*Application) CachePreheat ¶
func (app *Application) CachePreheat(f func(repo *Repository))
CachePreheat .
func (*Application) CreateH2CRunner ¶ added in v1.0.5
func (app *Application) CreateH2CRunner(addr string) iris.Runner
func (*Application) CreateParty ¶
CreateParty .
func (*Application) GetComponent ¶ added in v0.0.4
func (app *Application) GetComponent(ctx iris.Context, com interface{})
GetComponent .
func (*Application) GetService ¶
func (app *Application) GetService(ctx iris.Context, service interface{})
GetService .
func (*Application) InjectController ¶ added in v1.1.0
func (app *Application) InjectController(f interface{})
InjectController .
func (*Application) InstallGorm ¶ added in v1.0.5
func (app *Application) InstallGorm(f func() (db *gorm.DB, cache gcache.Plugin))
InstallGorm .
func (*Application) InstallMiddleware ¶ added in v1.0.5
func (app *Application) InstallMiddleware(handler iris.Handler)
InstallMiddleware .
func (*Application) InstallRedis ¶ added in v1.0.5
func (app *Application) InstallRedis(f func() (client *redis.Client))
InstallRedis .
func (*Application) Logger ¶ added in v1.0.5
func (app *Application) Logger() *golog.Logger
Logger .
func (*Application) Run ¶
func (app *Application) Run(serve iris.Runner, irisConf iris.Configuration)
Run .
type Component ¶ added in v0.0.3
type Component struct {
Runtime Runtime `json:"-"`
}
Component .
func (*Component) BeginRequest ¶ added in v0.0.3
BeginRequest .子实现多态
func (*Component) NewFastRequest ¶ added in v0.0.3
NewFastRequest .
func (*Component) NewH2CRequest ¶ added in v0.0.3
NewH2CRequest .
type ComponentPool ¶ added in v0.0.4
type ComponentPool struct {
// contains filtered or unexported fields
}
ComponentPool .
type Initiator ¶
type Initiator interface {
CreateParty(relativePath string, handlers ...context.Handler) iris.Party
BindController(relativePath string, controller interface{}, service ...interface{})
BindControllerByParty(party iris.Party, controller interface{}, service ...interface{})
BindService(f interface{})
InjectController(f interface{})
BindRepository(f interface{})
GetService(ctx iris.Context, service interface{})
AsyncCachePreheat(f func(repo *Repository))
CachePreheat(f func(repo *Repository))
//BindComponent 如果是单例 com是对象, 如果是多例,com是函数
BindComponent(single bool, com interface{})
GetComponent(ctx iris.Context, com interface{})
}
Initiator .
type JMap ¶
type JMap struct {
// contains filtered or unexported fields
}
func (*JMap) SetOrStore ¶
type Limiter ¶ added in v1.1.0
type Limiter struct {
Reorder
// contains filtered or unexported fields
}
Limiter 行数限制器
type Logger ¶
type Logger interface {
Print(v ...interface{})
Printf(format string, args ...interface{})
Println(v ...interface{})
Log(level golog.Level, v ...interface{})
Logf(level golog.Level, format string, args ...interface{})
Fatal(v ...interface{})
Fatalf(format string, args ...interface{})
Error(v ...interface{})
Errorf(format string, args ...interface{})
Warn(v ...interface{})
Warnf(format string, args ...interface{})
Info(v ...interface{})
Infof(format string, args ...interface{})
Debug(v ...interface{})
Debugf(format string, args ...interface{})
}
Logger .
type Pager ¶ added in v1.1.0
type Pager struct {
Reorder
// contains filtered or unexported fields
}
Pager 分页器
type Prometheus ¶
type Prometheus struct {
// contains filtered or unexported fields
}
Prometheus is a handler that exposes prometheus metrics for the number of requests, the latency and the response size, partitioned by status code, method and HTTP path.
Usage: pass its `ServeHTTP` to a route or globally.
type QueryBuilder ¶
type QueryBuilder interface {
Execute(db *gorm.DB, object interface{}) (e error)
Order() interface{}
Limit() int
}
QueryBuilder .
type Reorder ¶ added in v1.1.0
type Reorder struct {
// contains filtered or unexported fields
}
Reorder .
func (*Reorder) NewLimiter ¶ added in v1.1.0
NewLimiter .
type Repository ¶
type Repository struct {
Runtime Runtime
// contains filtered or unexported fields
}
Repository .
func (*Repository) NewAscOrder ¶
func (repo *Repository) NewAscOrder(field string, fields ...string) *Reorder
NewAscOrder .
func (*Repository) NewDescOrder ¶
func (repo *Repository) NewDescOrder(field string, fields ...string) *Reorder
NewDescOrder .
func (*Repository) NewFastRequest ¶
func (repo *Repository) NewFastRequest(url string) Request
NewFastRequest .
func (*Repository) NewH2CRequest ¶
func (repo *Repository) NewH2CRequest(url string) Request
NewH2CRequest .
func (*Repository) Transaction ¶
func (repo *Repository) Transaction(fun func() error) (e error)
Transaction .
type RepositoryPool ¶
type RepositoryPool struct {
// contains filtered or unexported fields
}
RepositoryPool .
type Runtime ¶
type Runtime interface {
Ctx() iris.Context
Logger() Logger
Store() *memstore.Store
Prometheus() *Prometheus
}
Runtime .
type ServicePool ¶
type ServicePool struct {
// contains filtered or unexported fields
}
ServicePool .
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) SetOrStore ¶
SetOrStore .