cCommand

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CommandConfigName = "CommandConf"
)

Variables

View Source
var Component = &CommandComponent{}

Functions

This section is empty.

Types

type CommandComponent added in v0.3.2

type CommandComponent struct{}

func (*CommandComponent) Inject added in v0.3.2

func (i *CommandComponent) Inject(instance any) bool

func (*CommandComponent) InjectConf added in v0.4.0

func (i *CommandComponent) InjectConf(config cComponents.ConfigInterface) bool

func (*CommandComponent) Listen added in v0.4.0

func (*CommandComponent) Load added in v0.3.2

func (i *CommandComponent) Load()

type CommandConf

type CommandConf struct {
	Enable   bool                   `json:"enable"`
	Commands []*CommandConf_Command `json:"commands"`
}

func (*CommandConf) ConfigName

func (i *CommandConf) ConfigName() string

type CommandConf_Command

type CommandConf_Command struct {

	// 配置项
	Mode    CommandMode `json:"mode"`    // 执行模式
	Instant bool        `json:"instant"` // 是否立即执行, sync 模式忽略此参数, 异步模式先执行一次, 再启动定时任务
	Wait    int         `json:"wait"`    // 每次执行等待时长
	Try     int         `json:"try"`     // 执行次数
	Cron    string      `json:"cron"`    // 定时器
	App     string      `json:"app"`
	Command string      `json:"command"`
	Method  string      `json:"method"`
	Options []string    `json:"options"` // 调用参数, 按顺序传入
	// contains filtered or unexported fields
}

func (*CommandConf_Command) Incr added in v0.4.0

func (i *CommandConf_Command) Incr()

func (*CommandConf_Command) Runnable added in v0.4.0

func (i *CommandConf_Command) Runnable() bool

func (*CommandConf_Command) SetID added in v0.4.0

func (i *CommandConf_Command) SetID(id cron.EntryID)

func (*CommandConf_Command) TryLock added in v0.4.0

func (i *CommandConf_Command) TryLock() bool

func (*CommandConf_Command) Unlock added in v0.4.0

func (i *CommandConf_Command) Unlock()

type CommandContainer

type CommandContainer struct {
	// contains filtered or unexported fields
}

func (*CommandContainer) Get added in v0.0.16

func (i *CommandContainer) Get(name string) any

func (*CommandContainer) Is added in v0.4.0

func (i *CommandContainer) Is(instance any) bool

func (*CommandContainer) Range added in v0.4.0

func (i *CommandContainer) Range(f func(instance any))

func (*CommandContainer) Remove added in v0.4.0

func (i *CommandContainer) Remove(name string) bool

func (*CommandContainer) Save added in v0.0.16

func (i *CommandContainer) Save(instance any) bool

type CommandInterface

type CommandInterface interface {
	CommandName() (app, name string)
}

type CommandMode added in v0.4.0

type CommandMode int
const (
	CommandMode_Single CommandMode = iota // 异步串行
	CommandMode_Multi                     // 异步并行
	CommandMode_Sync                      // 同步单次执行
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL