Documentation
¶
Index ¶
- Constants
- func ConvertAssign(dest, src interface{}) error
- func HandleBusMiddleware(worker Worker)
- func InSlice(array interface{}, item interface{}) bool
- func NewMap(dst interface{}) error
- func NewSlice(dsc interface{}, len int) error
- func Prepare(f func(Initiator))
- func SliceDelete(arr interface{}, indexArr ...int) error
- type Application
- func (app *Application) AsyncCachePreheat(f func(repo *Repository))
- func (app *Application) BindController(relativePath string, controller interface{}, handlers ...context.Handler)
- func (app *Application) BindControllerByParty(party iris.Party, controller interface{})
- func (app *Application) BindInfra(single bool, com interface{})
- func (app *Application) BindRepository(f interface{})
- func (app *Application) BindService(f interface{})
- func (app *Application) CachePreheat(f func(repo *Repository))
- func (app *Application) Closeing(f func())
- func (app *Application) CreateH2CRunner(addr string, configurators ...host.Configurator) iris.Runner
- func (app *Application) CreateParty(relativePath string, handlers ...context.Handler) iris.Party
- func (app *Application) CreateRunner(addr string, configurators ...host.Configurator) iris.Runner
- func (app *Application) EventsPath(infra interface{}) map[string]string
- func (app *Application) GetInfra(ctx iris.Context, com interface{})
- func (app *Application) GetService(ctx iris.Context, service interface{})
- func (app *Application) GetSingleInfra(com interface{})
- func (app *Application) InjectController(f interface{})
- func (app *Application) InstallBusMiddleware(handle ...BusHandler)
- func (app *Application) InstallDomainEventInfra(eventInfra DomainEventInfra)
- func (app *Application) InstallGorm(f func() (db *gorm.DB))
- func (app *Application) InstallMiddleware(handler iris.Handler)
- func (app *Application) InstallOther(f func() interface{})
- func (app *Application) InstallParty(relativePath string)
- func (app *Application) InstallRedis(f func() (client redis.Cmdable))
- func (app *Application) InstallSerializer(marshal func(v interface{}) ([]byte, error), ...)
- func (app *Application) Iris() *iris.Application
- func (app *Application) ListenEvent(eventName string, objectMethod string, appointInfra ...interface{})
- func (app *Application) Logger() *golog.Logger
- func (app *Application) Run(serve iris.Runner, irisConf iris.Configuration)
- func (app *Application) Start(f func(starter Starter))
- type BeginRequest
- type Builder
- type Bus
- type BusHandler
- type DomainEventInfra
- type Entity
- type EventBus
- type GORMRepository
- type Infra
- func (c *Infra) BeginRequest(rt Worker)
- func (c *Infra) DB() (db *gorm.DB)
- func (repo *Infra) GetOther(obj interface{})
- func (c *Infra) NewH2CRequest(url string, transferBus ...bool) Request
- func (c *Infra) NewHttpRequest(url string, transferBus ...bool) Request
- func (c *Infra) Redis() redis.Cmdable
- type InfraPool
- 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 Logger
- type Prometheus
- func (p *Prometheus) KafkaProducerWithLabelValues(topic string, e error, starTime time.Time)
- func (p *Prometheus) OrmWithLabelValues(model, method string, e error, starTime time.Time)
- func (p *Prometheus) RegisterCounter(conter *prometheus.CounterVec)
- func (p *Prometheus) RegisterHistogram(histogram *prometheus.HistogramVec)
- type QueryBuilder
- type Reorder
- type Repository
- func (repo *Repository) BeginRequest(rt Worker)
- func (repo *Repository) DB() (db *gorm.DB)
- func (repo *Repository) GetWorker() Worker
- func (repo *Repository) InjectBaseEntity(entity Entity)
- func (repo *Repository) InjectBaseEntitys(entitys interface{})
- func (repo *Repository) NewH2CRequest(url string, transferBus ...bool) Request
- func (repo *Repository) NewHttpRequest(url string, transferBus ...bool) Request
- func (repo *Repository) NewORMAscBuilder(column string, columns ...string) *Reorder
- func (repo *Repository) NewORMBuilder() *Builder
- func (repo *Repository) NewORMDescBuilder(column string, columns ...string) *Reorder
- func (repo *Repository) Other(obj interface{})
- func (repo *Repository) Redis() redis.Cmdable
- func (repo *Repository) SourceDB() (db *gorm.DB)
- type RepositoryPool
- type Request
- type Scanner
- type ServicePool
- type SingleBoot
- type Starter
- 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{}
- type UnitTest
- type UnitTestImpl
- func (u *UnitTestImpl) GetRepository(repository interface{})
- func (u *UnitTestImpl) GetService(service interface{})
- func (u *UnitTestImpl) InjectBaseEntity(entity interface{})
- func (u *UnitTestImpl) InstallDomainEventInfra(eventInfra DomainEventInfra)
- func (u *UnitTestImpl) InstallGorm(f func() (db *gorm.DB))
- func (u *UnitTestImpl) InstallRedis(f func() (client redis.Cmdable))
- func (u *UnitTestImpl) NewDomainEventInfra(call ...func(producer, topic string, data []byte, header map[string]string)) DomainEventInfra
- func (u *UnitTestImpl) Run()
- func (u *UnitTestImpl) SetRequest(request *http.Request)
- type Worker
Constants ¶
const (
WorkerKey = "freedom-worker-ctx"
)
Variables ¶
This section is empty.
Functions ¶
func ConvertAssign ¶
func ConvertAssign(dest, src interface{}) error
func HandleBusMiddleware ¶ added in v1.6.2
func HandleBusMiddleware(worker Worker)
func Prepare ¶ added in v1.6.2
func Prepare(f func(Initiator))
Prepare app.BindController or app.BindControllerByParty.
func SliceDelete ¶ added in v1.7.1
SliceDelete 删除数组指定下标元素
Types ¶
type Application ¶
type Application struct {
IrisApp *iris.Application
Database struct {
Install func() (db *gorm.DB)
// contains filtered or unexported fields
}
Cache struct {
Install func() (client redis.Cmdable)
// 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) BindController ¶
func (app *Application) BindController(relativePath string, controller interface{}, handlers ...context.Handler)
BindController .
func (*Application) BindControllerByParty ¶
func (app *Application) BindControllerByParty(party iris.Party, controller interface{})
BindControllerByParty .
func (*Application) BindInfra ¶ added in v1.3.0
func (app *Application) BindInfra(single bool, com interface{})
BindInfra .
func (*Application) BindRepository ¶
func (app *Application) BindRepository(f interface{})
BindRepository .
func (*Application) CachePreheat ¶
func (app *Application) CachePreheat(f func(repo *Repository))
CachePreheat .
func (*Application) Closeing ¶ added in v1.5.0
func (app *Application) Closeing(f func())
Register .
func (*Application) CreateH2CRunner ¶ added in v1.0.5
func (app *Application) CreateH2CRunner(addr string, configurators ...host.Configurator) iris.Runner
func (*Application) CreateParty ¶
CreateParty .
func (*Application) CreateRunner ¶ added in v1.5.0
func (app *Application) CreateRunner(addr string, configurators ...host.Configurator) iris.Runner
func (*Application) EventsPath ¶ added in v1.3.0
func (app *Application) EventsPath(infra interface{}) map[string]string
EventsPath .
func (*Application) GetInfra ¶ added in v1.3.0
func (app *Application) GetInfra(ctx iris.Context, com interface{})
GetInfra .
func (*Application) GetService ¶
func (app *Application) GetService(ctx iris.Context, service interface{})
GetService .
func (*Application) GetSingleInfra ¶ added in v1.6.2
func (app *Application) GetSingleInfra(com interface{})
GetSingleInfra .
func (*Application) InjectController ¶ added in v1.1.0
func (app *Application) InjectController(f interface{})
InjectController .
func (*Application) InstallBusMiddleware ¶ added in v1.6.2
func (app *Application) InstallBusMiddleware(handle ...BusHandler)
InstallBusMiddleware .
func (*Application) InstallDomainEventInfra ¶ added in v1.3.7
func (app *Application) InstallDomainEventInfra(eventInfra DomainEventInfra)
InstallDomainEventInfra .
func (*Application) InstallGorm ¶ added in v1.0.5
func (app *Application) InstallGorm(f func() (db *gorm.DB))
InstallGorm .
func (*Application) InstallMiddleware ¶ added in v1.0.5
func (app *Application) InstallMiddleware(handler iris.Handler)
InstallMiddleware .
func (*Application) InstallOther ¶ added in v1.6.2
func (app *Application) InstallOther(f func() interface{})
InstallOther .
func (*Application) InstallParty ¶ added in v1.2.1
func (app *Application) InstallParty(relativePath string)
InstallParty .
func (*Application) InstallRedis ¶ added in v1.0.5
func (app *Application) InstallRedis(f func() (client redis.Cmdable))
InstallRedis .
func (*Application) InstallSerializer ¶ added in v1.6.5
func (app *Application) InstallSerializer(marshal func(v interface{}) ([]byte, error), unmarshal func(data []byte, v interface{}) error)
InstallSerializer .
func (*Application) ListenEvent ¶ added in v1.3.0
func (app *Application) ListenEvent(eventName string, objectMethod string, appointInfra ...interface{})
ListenMessage .
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 .
func (*Application) Start ¶ added in v1.6.2
func (app *Application) Start(f func(starter Starter))
Start .
type Builder ¶ added in v1.5.8
type Builder struct {
// contains filtered or unexported fields
}
Builder
func (*Builder) SelectColumn ¶ added in v1.5.8
SelectColumn .
func (*Builder) SelectPrimary ¶ added in v1.5.8
SelectPrimary .
type BusHandler ¶ added in v1.6.2
type BusHandler func(Worker)
type DomainEventInfra ¶ added in v1.3.7
type EventBus ¶ added in v1.3.0
type EventBus struct {
// contains filtered or unexported fields
}
EventBus .
func (*EventBus) EventsPath ¶ added in v1.3.0
EventsPath .
type GORMRepository ¶
type GORMRepository interface {
DB() *gorm.DB
InjectBaseEntity(entity Entity)
InjectBaseEntitys(entitys interface{})
GetWorker() Worker
}
GORMRepository .
type Infra ¶ added in v1.3.0
type Infra struct {
Worker Worker `json:"-"`
}
Infra .
func (*Infra) BeginRequest ¶ added in v1.3.0
BeginRequest .子实现多态
func (*Infra) NewH2CRequest ¶ added in v1.3.0
NewH2CRequest, transferBus : Whether to pass the context, turned on by default. Typically used for tracking internal services.
func (*Infra) NewHttpRequest ¶ added in v1.5.5
NewHttpRequest, transferBus : Whether to pass the context, turned on by default. Typically used for tracking internal services.
type InfraPool ¶ added in v1.3.0
type InfraPool struct {
// contains filtered or unexported fields
}
InfraPool .
type Initiator ¶
type Initiator interface {
CreateParty(relativePath string, handlers ...context.Handler) iris.Party
BindController(relativePath string, controller interface{}, handlers ...context.Handler)
BindControllerByParty(party iris.Party, controller interface{})
BindService(f interface{})
InjectController(f interface{})
BindRepository(f interface{})
GetService(ctx iris.Context, service interface{})
//BindInfra 如果是单例 com是对象, 如果是多例,com是函数
BindInfra(single bool, com interface{})
GetInfra(ctx iris.Context, com interface{})
//监听事件
ListenEvent(eventName string, objectMethod string, appointInfra ...interface{})
Start(f func(starter Starter))
Iris() *iris.Application
}
Initiator .
type JMap ¶
type JMap struct {
// contains filtered or unexported fields
}
func (*JMap) SetOrStore ¶
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 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.
func (*Prometheus) KafkaProducerWithLabelValues ¶ added in v1.5.5
func (p *Prometheus) KafkaProducerWithLabelValues(topic string, e error, starTime time.Time)
func (*Prometheus) OrmWithLabelValues ¶ added in v1.5.5
func (p *Prometheus) OrmWithLabelValues(model, method string, e error, starTime time.Time)
func (*Prometheus) RegisterCounter ¶ added in v1.6.8
func (p *Prometheus) RegisterCounter(conter *prometheus.CounterVec)
func (*Prometheus) RegisterHistogram ¶ added in v1.6.8
func (p *Prometheus) RegisterHistogram(histogram *prometheus.HistogramVec)
type QueryBuilder ¶
type QueryBuilder interface {
Execute(db *gorm.DB, object interface{}) (e error)
Order() interface{}
}
QueryBuilder .
type Reorder ¶ added in v1.1.0
type Reorder struct {
// contains filtered or unexported fields
}
Reorder .
func (*Reorder) NewPageBuilder ¶ added in v1.5.8
NewPageBuilder .
type Repository ¶
type Repository struct {
Worker Worker
}
Repository .
func (*Repository) GetWorker ¶ added in v1.7.1
func (repo *Repository) GetWorker() Worker
GetRuntime .
func (*Repository) InjectBaseEntity ¶ added in v1.5.8
func (repo *Repository) InjectBaseEntity(entity Entity)
InjectBaseEntity .
func (*Repository) InjectBaseEntitys ¶ added in v1.5.8
func (repo *Repository) InjectBaseEntitys(entitys interface{})
InjectBaseEntity .
func (*Repository) NewH2CRequest ¶
func (repo *Repository) NewH2CRequest(url string, transferBus ...bool) Request
NewH2CRequest, transferBus : Whether to pass the context, turned on by default. Typically used for tracking internal services.
func (*Repository) NewHttpRequest ¶ added in v1.5.5
func (repo *Repository) NewHttpRequest(url string, transferBus ...bool) Request
NewHttpRequest, transferBus : Whether to pass the context, turned on by default. Typically used for tracking internal services.
func (*Repository) NewORMAscBuilder ¶ added in v1.5.8
func (repo *Repository) NewORMAscBuilder(column string, columns ...string) *Reorder
NewORMAscBuilder .
func (*Repository) NewORMBuilder ¶ added in v1.5.8
func (repo *Repository) NewORMBuilder() *Builder
NewORMBuilder .
func (*Repository) NewORMDescBuilder ¶ added in v1.5.8
func (repo *Repository) NewORMDescBuilder(column string, columns ...string) *Reorder
NewORMDescBuilder .
func (*Repository) SourceDB ¶ added in v1.7.1
func (repo *Repository) SourceDB() (db *gorm.DB)
SourceDB .
type RepositoryPool ¶
type RepositoryPool struct {
// contains filtered or unexported fields
}
RepositoryPool .
type ServicePool ¶
type ServicePool struct {
// contains filtered or unexported fields
}
ServicePool .
type SingleBoot ¶ added in v1.1.9
type SingleBoot interface {
Iris() *iris.Application
EventsPath(infra interface{}) map[string]string
Closeing(func())
}
SingleBoot .
type Starter ¶ added in v1.6.2
type Starter interface {
Iris() *iris.Application
//异步缓存预热
AsyncCachePreheat(f func(repo *Repository))
//同步缓存预热
CachePreheat(f func(repo *Repository))
GetSingleInfra(com interface{})
}
Starter .
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) SetOrStore ¶
SetOrStore .
type UnitTest ¶ added in v1.4.0
type UnitTest interface {
GetService(service interface{})
GetRepository(repository interface{})
InstallGorm(f func() (db *gorm.DB))
InstallRedis(f func() (client redis.Cmdable))
Run()
SetRequest(request *http.Request)
InjectBaseEntity(entity interface{})
InstallDomainEventInfra(eventInfra DomainEventInfra)
NewDomainEventInfra(call ...func(producer, topic string, data []byte, header map[string]string)) DomainEventInfra
}
type UnitTestImpl ¶ added in v1.4.1
type UnitTestImpl struct {
// contains filtered or unexported fields
}
func (*UnitTestImpl) GetRepository ¶ added in v1.4.1
func (u *UnitTestImpl) GetRepository(repository interface{})
func (*UnitTestImpl) GetService ¶ added in v1.4.1
func (u *UnitTestImpl) GetService(service interface{})
func (*UnitTestImpl) InjectBaseEntity ¶ added in v1.5.8
func (u *UnitTestImpl) InjectBaseEntity(entity interface{})
func (*UnitTestImpl) InstallDomainEventInfra ¶ added in v1.4.1
func (u *UnitTestImpl) InstallDomainEventInfra(eventInfra DomainEventInfra)
func (*UnitTestImpl) InstallGorm ¶ added in v1.4.1
func (u *UnitTestImpl) InstallGorm(f func() (db *gorm.DB))
func (*UnitTestImpl) InstallRedis ¶ added in v1.4.1
func (u *UnitTestImpl) InstallRedis(f func() (client redis.Cmdable))
func (*UnitTestImpl) NewDomainEventInfra ¶ added in v1.4.1
func (u *UnitTestImpl) NewDomainEventInfra(call ...func(producer, topic string, data []byte, header map[string]string)) DomainEventInfra
func (*UnitTestImpl) Run ¶ added in v1.4.1
func (u *UnitTestImpl) Run()
func (*UnitTestImpl) SetRequest ¶ added in v1.4.1
func (u *UnitTestImpl) SetRequest(request *http.Request)