Documentation
¶
Overview ¶
SPDX-License-Identifier: Apache-2.0
Index ¶
- Variables
- func CheckConfig(v interface{}, workers IWorkers) (map[RequireId]interface{}, error)
- func Now() string
- func RegisterProfessionDriver(name string, factory IProfessionDriverFactory) error
- func RegisterStoreDriver(name string, factory IStoreFactory)
- func TypeName(t reflect.Type) string
- func TypeNameOf(v interface{}) string
- func WriteError(w http.ResponseWriter, resultErr error)
- func WriteResult(w http.ResponseWriter, code string, resultType, resultKey string, ...)
- func WriteResultInfo(w http.ResponseWriter, resultType string, resultKey string, result interface{})
- func WriteResultInfoWithCode(w http.ResponseWriter, code string, resultType, resultKey string, ...)
- func WriteResultInfoWithPage(w http.ResponseWriter, resultType, resultKey string, result interface{}, ...)
- func WriteSuccessInData(w http.ResponseWriter, resultType, resultKey string, result interface{})
- func WriteSuccessNoData(w http.ResponseWriter, resultType string)
- type BytesData
- type DriverConfig
- type DriverDetail
- type DriverInfo
- type ExtendInfo
- type IAdmin
- type IAdminHandler
- type IData
- type IDriverRegister
- type IProfession
- type IProfessionDriver
- type IProfessionDriverCheckConfig
- type IProfessionDriverFactory
- type IProfessionDriverInfo
- type IProfessionDrivers
- type IProfessions
- type IRegister
- type IRegisterData
- type IStore
- type IStoreEventHandler
- type IStoreFactory
- type IStoreListener
- type IStoreLock
- type IStoreRW
- type IUntyped
- type IWorker
- type IWorkers
- type Item
- type JsonData
- type Marshaler
- type PageInfo
- type Profession
- func (p *Profession) AppendLabels() []string
- func (p *Profession) ChangeWorker(driver, id, name string, cdata IData, workers IWorkers) error
- func (p *Profession) CheckerConfig(driver string, cdata IData, workers IWorkers) error
- func (p *Profession) Dependencies() []string
- func (p *Profession) Desc() string
- func (p *Profession) Label() string
- func (p *Profession) Name() string
- type ProfessionConfig
- type ProfessionConfigs
- type ProfessionDriverRegister
- type ProfessionDrivers
- type ProfessionInfo
- type ProfessionItem
- type Professions
- func (ps *Professions) Delete(profession, name string) (*WorkerInfo, error)
- func (ps *Professions) DriverInfo(profession, driver string) (DriverDetail, error)
- func (ps *Professions) Drivers(profession string) ([]DriverInfo, error)
- func (ps *Professions) DriversItem(profession string) ([]Item, error)
- func (ps *Professions) GetEmployee(profession, name string) (interface{}, error)
- func (ps *Professions) Infos() []ProfessionInfo
- func (ps *Professions) ListEmployeeNames(profession string) ([]string, error)
- func (ps *Professions) ListEmployees(profession string) ([]interface{}, error)
- func (ps *Professions) ListProfessions() []ProfessionInfo
- func (ps *Professions) OnChange(v StoreValue) error
- func (ps *Professions) OnDel(v StoreValue) error
- func (ps *Professions) OnInit(vs []StoreValue) error
- func (ps *Professions) Render(profession, driver string) (*Render, error)
- func (ps *Professions) Renders(profession string) (map[string]*Render, error)
- func (ps *Professions) Save(v StoreValue) error
- func (ps *Professions) SearchBySkill(profession string, skill []string) ([]WorkerInfo, error)
- func (ps *Professions) Update(profession, name, driver string, data IData) (*WorkerInfo, error)
- type Register
- type Render
- type RequireId
- type StoreEventDispatcher
- type StoreValue
- type WorkManager
- type WorkerInfo
- type Workers
- type XMLData
- type YamlData
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorDriverNotExist = errors.New("driver not exist") ErrorProfessionNotExist = errors.New("profession not exist") ErrorWorkerNotExits = errors.New("worker not exits") ErrorRegisterConflict = errors.New("conflict of register") ErrorNotGetSillForRequire = errors.New("not get skill for require") ErrorTargetNotImplementSkill = errors.New("require of skill not implement") ErrorParamsIsNil = errors.New("params is nil") ErrorParamNotExist = errors.New("not exist") ErrorStoreReadOnly = errors.New("store read only") ErrorRequire = errors.New("require") ErrorProfessionDependencies = errors.New("profession dependencies not complete") ErrorConfigIsNil = errors.New("config is nil") ErrorConfigFieldUnknown = errors.New("unknown type") )
View Source
var ( SpaceProfession = "profession" SpaceWorker = "worker" )
Functions ¶
func CheckConfig ¶
func RegisterProfessionDriver ¶
func RegisterProfessionDriver(name string, factory IProfessionDriverFactory) error
func RegisterStoreDriver ¶
func RegisterStoreDriver(name string, factory IStoreFactory)
func TypeName ¶
func TypeNameOfValue(v reflect.Value) string { if v.Kind() == reflect.Ptr{ return TypeNameOfValue(v.Elem()) } return TypeName(v.Type()) }
func TypeNameOf ¶
func TypeNameOf(v interface{}) string
func WriteResult ¶
func WriteResult(w http.ResponseWriter, code string, resultType, resultKey string, result interface{}, pageInfo *PageInfo)
WriteResult 写响应
func WriteResultInfo ¶
func WriteResultInfo(w http.ResponseWriter, resultType string, resultKey string, result interface{})
WriteResultInfo 返回信息
func WriteResultInfoWithCode ¶
func WriteResultInfoWithCode(w http.ResponseWriter, code string, resultType, resultKey string, result interface{})
WriteResultInfoWithCode 返回带状态信息的响应
func WriteResultInfoWithPage ¶
func WriteResultInfoWithPage(w http.ResponseWriter, resultType, resultKey string, result interface{}, pageInfo *PageInfo)
WriteResultInfoWithPage 返回带页码信息的数据
func WriteSuccessInData ¶
func WriteSuccessInData(w http.ResponseWriter, resultType, resultKey string, result interface{})
WriteSuccessInData 返回包含于data中的成功信息
func WriteSuccessNoData ¶
func WriteSuccessNoData(w http.ResponseWriter, resultType string)
WriteSuccessNoData 返回无数据的成功信息
Types ¶
type DriverConfig ¶
type DriverDetail ¶
type DriverDetail struct { DriverInfo Extends ExtendInfo `json:"extends"` }
type DriverInfo ¶
type ExtendInfo ¶
type IAdmin ¶
type IAdmin interface { ListProfessions() []ProfessionInfo ListEmployees(profession string) ([]interface{}, error) ListEmployeeNames(profession string) ([]string, error) Update(profession, name, driver string, data IData) (*WorkerInfo, error) Delete(profession, name string) (*WorkerInfo, error) GetEmployee(profession, name string) (interface{}, error) Render(profession, driver string) (*Render, error) Renders(profession string) (map[string]*Render, error) Drivers(profession string) ([]DriverInfo, error) DriverInfo(profession, driver string) (DriverDetail, error) DriversItem(profession string) ([]Item, error) SearchBySkill(profession string, skill []string) ([]WorkerInfo, error) }
type IAdminHandler ¶
type IDriverRegister ¶
type IDriverRegister interface { RegisterProfessionDriver(name string, factory IProfessionDriverFactory) error GetProfessionDriver(name string) (IProfessionDriverFactory, bool) }
var (
DefaultProfessionDriverRegister IDriverRegister = NewProfessionDriverRegister()
)
type IProfession ¶
type IProfession interface { Name() string Label() string Desc() string Dependencies() []string AppendLabels() []string CheckerConfig(driver string, cdata IData, workers IWorkers) error ChangeWorker(driver, id, name string, cdata IData, workers IWorkers) error // contains filtered or unexported methods }
type IProfessionDriver ¶
type IProfessionDriverCheckConfig ¶ added in v0.0.7
type IProfessionDriverFactory ¶
type IProfessionDriverFactory interface { ExtendInfo() ExtendInfo Create(profession string, name string, label string, desc string, params map[string]string) (IProfessionDriver, error) }
func GetProfessionDriver ¶
func GetProfessionDriver(name string) (IProfessionDriverFactory, bool)
type IProfessionDriverInfo ¶
type IProfessionDriverInfo interface { IProfessionDriver ExtendInfo() ExtendInfo DriverInfo() DriverInfo }
type IProfessionDrivers ¶
type IProfessionDrivers interface { Get(name string) (driver IProfessionDriverInfo, has bool) List() []IProfessionDriverInfo Keys() []string }
func NewDrivers ¶
func NewDrivers(drivers []*_TProfessionDriver) IProfessionDrivers
type IProfessions ¶
type IProfessions interface {
Infos() []ProfessionInfo
}
type IRegister ¶
type IRegister interface { Register(name string, obj interface{}, force bool) error Get(name string) (interface{}, bool) }
func NewRegister ¶
func NewRegister() IRegister
type IRegisterData ¶
type IStore ¶
type IStore interface { IStoreLock GetListener() IStoreListener }
type IStoreEventHandler ¶
type IStoreEventHandler interface { OnInit(vs []StoreValue) error OnDel(v StoreValue) error OnChange(v StoreValue) error }
type IStoreFactory ¶
func GetStoreDriver ¶
func GetStoreDriver(name string) (IStoreFactory, bool)
type IStoreListener ¶
type IStoreListener interface {
AddListen(h IStoreEventHandler) error
}
type IStoreLock ¶
type IStoreRW ¶
type IStoreRW interface { Initialization() error All() []StoreValue Get(id string) (StoreValue, bool) Set(v StoreValue) error Del(id string) error ReadOnly() bool Reset([]StoreValue) error }
type IUntyped ¶
type IUntyped interface { Set(name string, v interface{}) Get(name string) (interface{}, bool) Del(name string) (interface{}, bool) List() []interface{} Keys() []string All() map[string]interface{} Clone() IUntyped Count() int }
func NewUntyped ¶
func NewUntyped() IUntyped
type IWorkers ¶
type IWorkers interface { Set(id string, w IWorker) Del(id string) (IWorker, bool) Get(id string) (IWorker, bool) }
func NewWorkers ¶
func NewWorkers() IWorkers
type PageInfo ¶
type PageInfo struct { ItemNum int `json:"itemNum,"` Page int `json:"page,omitempty"` PageSize int `json:"pageSize,omitempty"` TotalNum int `json:"totalNum,"` }
PageInfo 页码信息
type Profession ¶
type Profession struct {
// contains filtered or unexported fields
}
func (*Profession) AppendLabels ¶
func (p *Profession) AppendLabels() []string
func (*Profession) ChangeWorker ¶ added in v0.0.7
func (p *Profession) ChangeWorker(driver, id, name string, cdata IData, workers IWorkers) error
func (*Profession) CheckerConfig ¶ added in v0.0.7
func (p *Profession) CheckerConfig(driver string, cdata IData, workers IWorkers) error
func (*Profession) Dependencies ¶
func (p *Profession) Dependencies() []string
func (*Profession) Desc ¶
func (p *Profession) Desc() string
func (*Profession) Label ¶
func (p *Profession) Label() string
func (*Profession) Name ¶
func (p *Profession) Name() string
type ProfessionConfig ¶
type ProfessionConfigs ¶
type ProfessionConfigs []ProfessionConfig
func (ProfessionConfigs) Gen ¶
func (pcs ProfessionConfigs) Gen(driverRegister IDriverRegister, store IStore) (*Professions, error)
type ProfessionDriverRegister ¶
type ProfessionDriverRegister struct {
// contains filtered or unexported fields
}
func NewProfessionDriverRegister ¶
func NewProfessionDriverRegister() *ProfessionDriverRegister
func (*ProfessionDriverRegister) GetProfessionDriver ¶
func (p *ProfessionDriverRegister) GetProfessionDriver(name string) (IProfessionDriverFactory, bool)
func (*ProfessionDriverRegister) RegisterProfessionDriver ¶
func (p *ProfessionDriverRegister) RegisterProfessionDriver(name string, factory IProfessionDriverFactory) error
type ProfessionDrivers ¶
type ProfessionDrivers struct {
// contains filtered or unexported fields
}
func (*ProfessionDrivers) Get ¶
func (d *ProfessionDrivers) Get(name string) (IProfessionDriverInfo, bool)
func (*ProfessionDrivers) Keys ¶
func (d *ProfessionDrivers) Keys() []string
func (*ProfessionDrivers) List ¶
func (d *ProfessionDrivers) List() []IProfessionDriverInfo
type ProfessionInfo ¶
type ProfessionItem ¶
type ProfessionItem struct { }
type Professions ¶
type Professions struct {
// contains filtered or unexported fields
}
func (*Professions) Delete ¶
func (ps *Professions) Delete(profession, name string) (*WorkerInfo, error)
func (*Professions) DriverInfo ¶
func (ps *Professions) DriverInfo(profession, driver string) (DriverDetail, error)
func (*Professions) Drivers ¶
func (ps *Professions) Drivers(profession string) ([]DriverInfo, error)
func (*Professions) DriversItem ¶
func (ps *Professions) DriversItem(profession string) ([]Item, error)
func (*Professions) GetEmployee ¶ added in v0.0.7
func (ps *Professions) GetEmployee(profession, name string) (interface{}, error)
func (*Professions) Infos ¶
func (ps *Professions) Infos() []ProfessionInfo
func (*Professions) ListEmployeeNames ¶ added in v0.0.7
func (ps *Professions) ListEmployeeNames(profession string) ([]string, error)
func (*Professions) ListEmployees ¶
func (ps *Professions) ListEmployees(profession string) ([]interface{}, error)
ListEmployees
func (*Professions) ListProfessions ¶
func (ps *Professions) ListProfessions() []ProfessionInfo
ListProfessions
func (*Professions) OnChange ¶
func (ps *Professions) OnChange(v StoreValue) error
func (*Professions) OnDel ¶
func (ps *Professions) OnDel(v StoreValue) error
func (*Professions) OnInit ¶
func (ps *Professions) OnInit(vs []StoreValue) error
func (*Professions) Render ¶
func (ps *Professions) Render(profession, driver string) (*Render, error)
func (*Professions) Renders ¶
func (ps *Professions) Renders(profession string) (map[string]*Render, error)
func (*Professions) Save ¶ added in v0.0.7
func (ps *Professions) Save(v StoreValue) error
func (*Professions) SearchBySkill ¶
func (ps *Professions) SearchBySkill(profession string, skill []string) ([]WorkerInfo, error)
func (*Professions) Update ¶
func (ps *Professions) Update(profession, name, driver string, data IData) (*WorkerInfo, error)
type StoreEventDispatcher ¶
type StoreEventDispatcher struct {
// contains filtered or unexported fields
}
func NewStoreDispatcher ¶
func NewStoreDispatcher() *StoreEventDispatcher
func (*StoreEventDispatcher) AddListen ¶
func (s *StoreEventDispatcher) AddListen(h IStoreEventHandler) bool
func (*StoreEventDispatcher) DispatchChange ¶
func (s *StoreEventDispatcher) DispatchChange(v StoreValue) error
func (*StoreEventDispatcher) DispatchDel ¶
func (s *StoreEventDispatcher) DispatchDel(v StoreValue) error
func (*StoreEventDispatcher) DispatchInit ¶
func (s *StoreEventDispatcher) DispatchInit(vs []StoreValue) error
type StoreValue ¶
type WorkManager ¶
type WorkManager struct {
// contains filtered or unexported fields
}
func (*WorkManager) Set ¶ added in v0.0.7
func (wm *WorkManager) Set(id string, w IWorker)
type WorkerInfo ¶
Source Files
¶
- admin.go
- config.go
- driver-register.go
- driver.go
- drivers.go
- eosc.go
- error.go
- format.go
- marshal.go
- namespace.go
- profession-admin.go
- profession-config.go
- profession-worker.go
- profession.go
- professions-event.go
- professions.go
- register.go
- render-tool.go
- render.go
- store-event.go
- store-register.go
- store.go
- untyped.go
- utils.go
- worker.go
- workers.go
- write_result.go
Click to show internal directories.
Click to hide internal directories.