Documentation
¶
Index ¶
- type CmdExecuteHookProtoPost
- type CmdExecuteHookProtoPre
- type CommandExecutorProto
- type ConfigCacheItem
- type ConfigInitItem
- type ConfigItem
- func (c *ConfigItem) Bool() bool
- func (c *ConfigItem) Fill(dest any)
- func (c *ConfigItem) Float32() float32
- func (c *ConfigItem) Float64() float64
- func (c *ConfigItem) Index() int
- func (c *ConfigItem) Int() int
- func (c *ConfigItem) Int8() int8
- func (c *ConfigItem) Int16() int16
- func (c *ConfigItem) Int32() int32
- func (c *ConfigItem) Int64() int64
- func (c *ConfigItem) Key() string
- func (c *ConfigItem) SetValue(v any)
- func (c *ConfigItem) String() string
- func (c *ConfigItem) TryBool() (bool, bool)
- func (c *ConfigItem) TryFill(dest any) (ok bool)
- func (c *ConfigItem) TryFloat32() (float32, bool)
- func (c *ConfigItem) TryFloat64() (float64, bool)
- func (c *ConfigItem) TryInt() (int, bool)
- func (c *ConfigItem) TryInt8() (int8, bool)
- func (c *ConfigItem) TryInt16() (int16, bool)
- func (c *ConfigItem) TryInt32() (int32, bool)
- func (c *ConfigItem) TryInt64() (int64, bool)
- func (c *ConfigItem) TryString() (res string, ok bool)
- func (c *ConfigItem) TryUint() (uint, bool)
- func (c *ConfigItem) TryUint8() (uint8, bool)
- func (c *ConfigItem) TryUint16() (uint16, bool)
- func (c *ConfigItem) TryUint32() (uint32, bool)
- func (c *ConfigItem) TryUint64() (uint64, bool)
- func (c *ConfigItem) Uint() uint
- func (c *ConfigItem) Uint8() uint8
- func (c *ConfigItem) Uint16() uint16
- func (c *ConfigItem) Uint32() uint32
- func (c *ConfigItem) Uint64() uint64
- func (c *ConfigItem) Updated() int64
- func (c *ConfigItem) Value() any
- func (c *ConfigItem) Value2() (val any, updated int64)
- type EngineCtxKey
- type Event2MapOpts
- type EventAction
- type EventCategory
- type EventCloneOpts
- type EventDataProto
- type EventDataType
- type EventKind
- type EventOpt
- type EventOwnerType
- type EventPriority
- type EventSetDataProto
- type EventStatus
- type EventType
- type HookExecuteProto
- type ICommand
- type ICommandExecutor
- type ICommandHooks
- type ICommandInfo
- type ICommandManager
- type ICommandReplacer
- type ICommandSignature
- type IData
- type IDataFromFile
- type IDataFromMem
- type IEngine
- type IEngineConfig
- type IEvent
- type IHook
- type IHookImpl
- type IHookManager
- type IMeta
- type IMetaSource
- type IObjectManager
- type IPlugin
- type IPluginCommandExecutor
- type IPluginCommands
- type IPluginConfig
- type IPluginConfigInitItems
- type IPluginConnect
- type IPluginHooks
- type IPluginMainConfig
- type IPluginManager
- type IPluginVars
- type NewEventArgs
- type PluginHook
- type PluginHookPositionProto
- type PluginMainConfigPluginItem
- type PluginVarItem
- type Settings
- func (s Settings) DbIsJsonData() bool
- func (s Settings) Get(key string) (val any, ok bool)
- func (s Settings) GetBool(key string) (val bool, ok bool)
- func (s Settings) GetBoolOrDefault(key string, def bool) bool
- func (s Settings) GetFloat(key string) (val float64, ok bool)
- func (s Settings) GetFloatOrDefault(key string, def float64) float64
- func (s Settings) GetInt(key string) (val int64, ok bool)
- func (s Settings) GetIntOrDefault(key string, def int64) int64
- func (s Settings) GetString(key string) (val string, ok bool)
- func (s Settings) GetStringOrDefault(key string, def string) string
- func (s Settings) GetUint(key string) (val uint64, ok bool)
- func (s Settings) GetUintOrDefault(key string, def uint64) uint64
- func (s *Settings) Scan(value any) error
- func (s Settings) Set(key string, val any)
- func (s Settings) String() string
- func (s Settings) Value() (driver.Value, error)
- type UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdExecuteHookProtoPost ¶
type CmdExecuteHookProtoPre ¶
type CmdExecuteHookProtoPre func(ctx context.Context, cmdInfo ICommandInfo, eventIn IEvent) error
type CommandExecutorProto ¶
type ConfigCacheItem ¶
type ConfigCacheItem[T any] struct { // contains filtered or unexported fields }
func NewConfigCacheItem ¶
func NewConfigCacheItem[T any]() ConfigCacheItem[T]
func (*ConfigCacheItem[T]) Key ¶
func (c *ConfigCacheItem[T]) Key() string
func (*ConfigCacheItem[T]) Raw ¶
func (c *ConfigCacheItem[T]) Raw() *ConfigItem
func (*ConfigCacheItem[T]) Set ¶
func (c *ConfigCacheItem[T]) Set(item *ConfigItem) bool
func (*ConfigCacheItem[T]) Value ¶
func (c *ConfigCacheItem[T]) Value() T
type ConfigInitItem ¶
type ConfigInitItem struct {
Key string
Index *int
ItemRef any
DefaultValue any
Optional bool
Type string
CacheItemRef any
// Указывает значение устанавливается программно и может остуствовать в конфигурационном файле
Internal bool
}
Type in [Int,Float,Bool,String,Uuid,Path,time.Second,Any]
type ConfigItem ¶
type ConfigItem struct {
// contains filtered or unexported fields
}
func NewConfigItem ¶
func NewConfigItem(index int, key string, val any) *ConfigItem
func (*ConfigItem) Bool ¶
func (c *ConfigItem) Bool() bool
func (*ConfigItem) Fill ¶
func (c *ConfigItem) Fill(dest any)
func (*ConfigItem) Float32 ¶
func (c *ConfigItem) Float32() float32
func (*ConfigItem) Float64 ¶
func (c *ConfigItem) Float64() float64
func (*ConfigItem) Index ¶
func (c *ConfigItem) Index() int
func (*ConfigItem) Int ¶
func (c *ConfigItem) Int() int
func (*ConfigItem) Int8 ¶
func (c *ConfigItem) Int8() int8
func (*ConfigItem) Int16 ¶
func (c *ConfigItem) Int16() int16
func (*ConfigItem) Int32 ¶
func (c *ConfigItem) Int32() int32
func (*ConfigItem) Int64 ¶
func (c *ConfigItem) Int64() int64
func (*ConfigItem) Key ¶
func (c *ConfigItem) Key() string
func (*ConfigItem) SetValue ¶
func (c *ConfigItem) SetValue(v any)
func (*ConfigItem) String ¶
func (c *ConfigItem) String() string
func (*ConfigItem) TryBool ¶
func (c *ConfigItem) TryBool() (bool, bool)
func (*ConfigItem) TryFill ¶
func (c *ConfigItem) TryFill(dest any) (ok bool)
func (*ConfigItem) TryFloat32 ¶
func (c *ConfigItem) TryFloat32() (float32, bool)
func (*ConfigItem) TryFloat64 ¶
func (c *ConfigItem) TryFloat64() (float64, bool)
func (*ConfigItem) TryInt ¶
func (c *ConfigItem) TryInt() (int, bool)
func (*ConfigItem) TryInt8 ¶
func (c *ConfigItem) TryInt8() (int8, bool)
func (*ConfigItem) TryInt16 ¶
func (c *ConfigItem) TryInt16() (int16, bool)
func (*ConfigItem) TryInt32 ¶
func (c *ConfigItem) TryInt32() (int32, bool)
func (*ConfigItem) TryInt64 ¶
func (c *ConfigItem) TryInt64() (int64, bool)
func (*ConfigItem) TryString ¶
func (c *ConfigItem) TryString() (res string, ok bool)
func (*ConfigItem) TryUint ¶
func (c *ConfigItem) TryUint() (uint, bool)
func (*ConfigItem) TryUint8 ¶
func (c *ConfigItem) TryUint8() (uint8, bool)
func (*ConfigItem) TryUint16 ¶
func (c *ConfigItem) TryUint16() (uint16, bool)
func (*ConfigItem) TryUint32 ¶
func (c *ConfigItem) TryUint32() (uint32, bool)
func (*ConfigItem) TryUint64 ¶
func (c *ConfigItem) TryUint64() (uint64, bool)
func (*ConfigItem) Uint ¶
func (c *ConfigItem) Uint() uint
func (*ConfigItem) Uint8 ¶
func (c *ConfigItem) Uint8() uint8
func (*ConfigItem) Uint16 ¶
func (c *ConfigItem) Uint16() uint16
func (*ConfigItem) Uint32 ¶
func (c *ConfigItem) Uint32() uint32
func (*ConfigItem) Uint64 ¶
func (c *ConfigItem) Uint64() uint64
func (*ConfigItem) Updated ¶
func (c *ConfigItem) Updated() int64
func (*ConfigItem) Value ¶
func (c *ConfigItem) Value() any
func (*ConfigItem) Value2 ¶
func (c *ConfigItem) Value2() (val any, updated int64)
type EngineCtxKey ¶
type EngineCtxKey struct{}
type Event2MapOpts ¶
type EventAction ¶
type EventAction uint16
func (EventAction) DbString ¶
func (e EventAction) DbString() string
type EventCategory ¶
type EventCategory uint16
func (EventCategory) DbString ¶
func (e EventCategory) DbString() string
type EventCloneOpts ¶
type EventCloneOpts struct {
VirtualUuid *UUID
Uuid *UUID
Kind *EventKind
Category []EventCategory
Action *EventAction
Type *EventType
Status *EventStatus
Priority *EventPriority
Meta IMeta
DataSize *int64
DataMaxSize *int64
DataType *EventDataType
OwnerUuid *UUID
OwnerType *EventOwnerType
Created *int64
Expired *int64
Opts map[EventOpt]any
}
type EventDataProto ¶
type EventDataType ¶
type EventDataType uint16
func (EventDataType) DbString ¶
func (e EventDataType) DbString() string
type EventOwnerType ¶
type EventOwnerType uint8
func (EventOwnerType) DbString ¶
func (e EventOwnerType) DbString() string
type EventPriority ¶
type EventPriority uint16
func (EventPriority) DbString ¶
func (e EventPriority) DbString() string
type EventSetDataProto ¶
type EventStatus ¶
type EventStatus uint16
func (EventStatus) DbString ¶
func (e EventStatus) DbString() string
type HookExecuteProto ¶
type ICommand ¶
type ICommand interface {
Name() string
Kind() EventKind
Category() []EventCategory
Action() EventAction
CheckAccess(ctx context.Context, eventIn IEvent) (ok bool, err error)
Execute(ctx context.Context, eventIn IEvent) (eventOut IEvent, err error)
CheckOnResultAccess(ctx context.Context, event IEvent) (ok bool, err error)
OnResult(ctx context.Context, event IEvent) (IEvent, error)
OnResultError(ctx context.Context, event IEvent) (IEvent, error)
}
ICommand интерфейс описывает базовые методы команд
type ICommandExecutor ¶
type ICommandHooks ¶
type ICommandHooks interface {
ExecutePre(ctx context.Context, cmdInfo ICommandInfo, eventIn IEvent) error
ExecutePost(ctx context.Context, cmdInfo ICommandInfo, eventIn IEvent, eventOut IEvent, err error) error
AddPre(plugin IPlugin, fn CmdExecuteHookProtoPre)
RemovePre(plugin IPlugin, fn ...CmdExecuteHookProtoPre)
AddPost(plugin IPlugin, fn CmdExecuteHookProtoPost)
RemovePost(plugin IPlugin, fn ...CmdExecuteHookProtoPost)
}
type ICommandInfo ¶
type ICommandInfo interface {
Plugin() IPlugin
Command() ICommand
Hooks() ICommandHooks
ExecutePreHook(ctx context.Context, eventIn IEvent) error
AddPreHook(plugin IPlugin, fn CmdExecuteHookProtoPre)
RemovePreHook(plugin IPlugin, fn ...CmdExecuteHookProtoPre)
ExecutePostHook(ctx context.Context, eventIn IEvent, eventOut IEvent, err error) error
AddPostHook(plugin IPlugin, fn CmdExecuteHookProtoPost)
RemovePostHook(plugin IPlugin, fn ...CmdExecuteHookProtoPost)
}
type ICommandManager ¶
type ICommandManager interface {
fmt.Stringer
IPluginConnect
Executor() ICommandExecutor
SetExecutor(ctx context.Context, plugin IPlugin) (err error)
Execute(ctx context.Context, event IEvent) (IEvent, error)
Id(sig ICommandSignature) (cmdId int64, err error)
Name(sig ICommandSignature) (name string, err error)
Path(sig ICommandSignature) string
Signature(cmdId int64) (sig ICommandSignature, err error)
AddPreHook(plugin IPlugin, fn CmdExecuteHookProtoPre)
RemovePreHook(plugin IPlugin, fn ...CmdExecuteHookProtoPre)
AddPostHook(plugin IPlugin, fn CmdExecuteHookProtoPost)
RemovePostHook(plugin IPlugin, fn ...CmdExecuteHookProtoPost)
}
type ICommandReplacer ¶
type ICommandReplacer interface {
// ShouldReplace возвращает true, если команда должна быть установлена, внезависимости от того, существует ли
// другая команда с таким именем или нет.
ShouldReplace() bool
}
type ICommandSignature ¶
type ICommandSignature interface {
Kind() EventKind
Category() []EventCategory
Action() EventAction
}
type IDataFromFile ¶
type IDataFromFile = adata.IDataFromFile
type IDataFromMem ¶
type IDataFromMem = adata.IDataFromMem
type IEngine ¶
type IEngine interface {
Config() IEngineConfig
SetConfig(config IEngineConfig, force bool) error
ObjectManager() IObjectManager
}
type IEngineConfig ¶
type IEngineConfig interface {
IPluginConnect
Filepath() string
Raw() (raw map[string]any, err error)
PrepareKeys(key ...string) (key2index map[string]int, err error)
Index(key string) (index int)
Key(index int) (key string)
KeyList() []string
Item(index int) *ConfigItem
Item2(key string) *ConfigItem
Count() int
Set(index int, val any) error
Set2(key string, val any) error
Value(index int) any
Value2(key string) any
String(index int) string
Int64(index int) int64
Int(index int) int
Int8(index int) int8
Int16(index int) int16
Int32(index int) int32
Uint64(index int) uint64
Uint(index int) uint
Uint8(index int) uint8
Uint16(index int) uint16
Uint32(index int) uint32
Float64(index int) float64
Float32(index int) float32
Bool(index int) bool
ValueOrDefault(index int, d any) any
ValueOrDefault2(key string, d any) any
StringOrDefault(index int, d string) string
Int64OrDefault(index int, d int64) int64
IntOrDefault(index int, d int) int
Int8OrDefault(index int, d int8) int8
Int16OrDefault(index int, d int16) int16
Int32OrDefault(index int, d int32) int32
Uint64OrDefault(index int, d uint64) uint64
UintOrDefault(index int, d uint) uint
Uint8OrDefault(index int, d uint8) uint8
Uint16OrDefault(index int, d uint16) uint16
Uint32OrDefault(index int, d uint32) uint32
Float64OrDefault(index int, d float64) float64
Float32OrDefault(index int, d float32) float32
BoolOrDefault(index int, d bool) bool
TryValue(index int) (val any, ok bool)
TryValue2(key string) (val any, ok bool)
TryString(index int) (res string, ok bool)
TryInt64(index int) (int64, bool)
TryInt(index int) (int, bool)
TryInt8(index int) (int8, bool)
TryInt16(index int) (int16, bool)
TryInt32(index int) (int32, bool)
TryUint64(index int) (uint64, bool)
TryUint(index int) (uint, bool)
TryUint8(index int) (uint8, bool)
TryUint16(index int) (uint16, bool)
TryUint32(index int) (uint32, bool)
TryFloat64(index int) (float64, bool)
TryFloat32(index int) (float32, bool)
TryBool(index int) (bool, bool)
}
type IEvent ¶
type IEvent interface {
fmt.Stringer
IMetaSource
Uuid() UUID
VirtualUuid() UUID
SetVirtualUuid(uuid UUID)
Kind() EventKind
Category() []EventCategory
Action() EventAction
Type() EventType
Status() EventStatus
SetStatus(status EventStatus)
Priority() EventPriority
Meta() IMeta
SetMeta(data map[string]any)
MetaSize() int64
IsData() bool
Data(ctx context.Context) (IData, error)
SetData(ctx context.Context, data any, size ...int64) error
SetDataRaw(ctx context.Context, data any, size ...int64) error
SetData2(ctx context.Context, data any, dataType EventDataType, size ...int64) error
SetDataRaw2(ctx context.Context, data any, dataType EventDataType, size ...int64) error
DataSize() int64
SetDataSize(size int64)
DataMaxSize() int64
SetDataMaxSize(size int64)
DataType() EventDataType
SetDataType(dataType EventDataType)
Opts() map[EventOpt]any
OptVal(key EventOpt) (any, bool)
SetOptVal(key EventOpt, val any)
OwnerUuid() UUID
OwnerType() EventOwnerType
Created() int64
Expired() int64
ToMap() map[string]any
Clone(opts EventCloneOpts) (IEvent, error)
CloneWithType(type_ EventType) (IEvent, error)
CloneWithMeta(type_ EventType, meta map[string]any) (IEvent, error)
CloneWithData(ctx context.Context, type_ EventType, data any) (IEvent, error)
CloneWithMetaAndData(ctx context.Context, type_ EventType, meta map[string]any, data any) (IEvent, error)
}
type IHookManager ¶
type IHookManager interface {
IPluginConnect
Register(hookName string, prototype any) (IHook, error)
Get(name string) IHook
Execute(ctx context.Context, hookName string, f HookExecuteProto) (err error)
Execute2(ctx context.Context, hook IHook, f HookExecuteProto) (err error)
Execute3(ctx context.Context, index int, f HookExecuteProto) (err error)
MustExecute(ctx context.Context, hookName string, f HookExecuteProto) (err error)
MustExecute2(ctx context.Context, hook IHook, f HookExecuteProto) (err error)
MustExecute3(ctx context.Context, index int, f HookExecuteProto) (err error)
}
type IMetaSource ¶
type IMetaSource interface {
IsMetaSource()
}
IMetaSource используется для идентификации типов, которые могут предоставлять информацию о метаданных.
type IObjectManager ¶
type IPlugin ¶
type IPlugin interface {
Name() string
Version() string
Tag() string
Active() bool
Settings() Settings
PreInit(ctx context.Context, install bool) error
Init(ctx context.Context, install bool) error
Update(ctx context.Context, pluginConfig IPluginConfig) error
Load(ctx context.Context, pluginConfig IPluginConfig) error
}
type IPluginCommandExecutor ¶
type IPluginCommandExecutor interface {
CommandExecutor() CommandExecutorProto
}
type IPluginCommands ¶
type IPluginCommands interface {
Commands() []ICommand
}
type IPluginConfig ¶
type IPluginConfigInitItems ¶
type IPluginConfigInitItems interface {
ConfigInitItems() []ConfigInitItem
}
type IPluginConnect ¶
type IPluginHooks ¶
type IPluginHooks interface {
Hooks() []PluginHook
}
type IPluginMainConfig ¶
type IPluginMainConfig interface {
Plugins() []PluginMainConfigPluginItem
}
type IPluginManager ¶
type IPluginManager interface {
Get(tag string) IPlugin
Config(ctx context.Context, tag string) IPluginConfig
Register(ctx context.Context, plugin IPlugin, external bool) (new bool, err error)
Load(ctx context.Context, plugin IPlugin) error
MainConfig() IPluginMainConfig
ReloadMainConfig() error
DeleteConfig(ctx context.Context, plugin IPlugin) error
ResetConfigs(ctx context.Context) error
}
type IPluginVars ¶
type IPluginVars interface {
Vars() []PluginVarItem
}
type NewEventArgs ¶
type NewEventArgs struct {
VirtualUuid UUID
Uuid UUID
Kind EventKind
Category []EventCategory
Action EventAction
Type EventType
Status EventStatus
Priority EventPriority
Meta IMeta
DataSize int64
DataMaxSize int64
DataType EventDataType
OwnerUuid UUID
OwnerType EventOwnerType
Created int64
Expired int64
Opts map[EventOpt]any
}
type PluginHook ¶
type PluginHook struct {
RawHook *IHook
// Name указывается если не задан RawHook
Name string
// Prototype указывается если не задан RawHook. При этом Prototype может отсуствовать, если известно,
// что хук уже зарегистрирован.
Prototype any
// Optional. Реализация может отсуствовать, если вы хотите только получить ссылку на хук.
Impl any
// Optional. Определяет позицию, в которую нужно поместить реализацию.
Position int
// Optional. Выполняется перед хуком
PreHook bool
// Optional. Выполняется после хука
PostHook bool
// Optional. Колбек используется для определения позиции, в которую нужно поместить реализацию.
// Если он не задн, используется pluginHook.Position
PositionCallback PluginHookPositionProto
}
При создании PluginHook, необходимо задать либо RawHook, либо Name + Prototype.
type PluginHookPositionProto ¶
type PluginVarItem ¶
type Settings ¶
func (Settings) DbIsJsonData ¶
func (Settings) GetFloatOrDefault ¶
func (Settings) GetStringOrDefault ¶
func (Settings) GetUintOrDefault ¶
Click to show internal directories.
Click to hide internal directories.