Documentation
¶
Index ¶
- func BytesUUID(input []byte) (uuid.UUID, bool)
- func ExecuteCommand(name string, args ...string) (error, bool)
- func ListCommands() []string
- func ObjectUUID(object any) (uuid.UUID, bool)
- func RegisterCommand(name string, fn CommandFunc) error
- func RunAdditional() (error, bool)
- func StringUUID(input string) (uuid.UUID, bool)
- type AppStarter
- func (s *AppStarter) AddValue(key, value any)
- func (s *AppStarter) AddWorker()
- func (s *AppStarter) DoneWorker()
- func (s *AppStarter) MustStopApp(exitCode int)
- func (s *AppStarter) Started() time.Time
- func (s *AppStarter) StopApp()
- func (s *AppStarter) UseContextAdders(addFunc ...func(context.Context) context.Context)
- func (s *AppStarter) Wait()
- func (s *AppStarter) WaitWorkers(timeout time.Duration) error
- func (s *AppStarter) WorkTime() time.Duration
- func (s *AppStarter) WrapWorker(f func())
- type CommandFunc
- type WorkTimerCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteCommand ¶ added in v1.6.1
ExecuteCommand executes a registered command by name with arguments. Returns error if command is not found or function itself returns error.
func ListCommands ¶ added in v1.6.1
func ListCommands() []string
ListCommands returns a list of all registered command names.
func ObjectUUID ¶
BytesUUID – generates uuid (v5) from object
func RegisterCommand ¶ added in v1.6.1
func RegisterCommand(name string, fn CommandFunc) error
RegisterCommand registers a command function with a unique name. Returns an error if the name is already used.
func RunAdditional ¶ added in v1.6.1
Types ¶
type AppStarter ¶
func InitAppStart ¶
func InitAppStart(preInitFunc func() error) *AppStarter
InitAppStart – create app root context and stop function object
func InitAppStartWithContext ¶
func InitAppStartWithContext(ctx context.Context, preInitFunc func() error) *AppStarter
InitAppStartWithContext – create app root context and stop function object form external context. Must be used with pre init function. If their init will be errored – panic closes app
func (*AppStarter) AddValue ¶
func (s *AppStarter) AddValue(key, value any)
AddValue – appends to context values with key
func (*AppStarter) AddWorker ¶ added in v1.5.6
func (s *AppStarter) AddWorker()
AddWorker – appends worker
func (*AppStarter) DoneWorker ¶ added in v1.5.6
func (s *AppStarter) DoneWorker()
DoneWorker – final worker
func (*AppStarter) MustStopApp ¶
func (s *AppStarter) MustStopApp(exitCode int)
MustStopApp – cancel root app context and extremely stops app with exit code
func (*AppStarter) Started ¶ added in v1.6.1
func (s *AppStarter) Started() time.Time
func (*AppStarter) StopApp ¶
func (s *AppStarter) StopApp()
StopApp – cancel root app context and stopping app
func (*AppStarter) UseContextAdders ¶
func (s *AppStarter) UseContextAdders( addFunc ...func(context.Context) context.Context, )
UseContextAdders – uses func list that returns new context
func (*AppStarter) WaitWorkers ¶ added in v1.5.6
func (s *AppStarter) WaitWorkers(timeout time.Duration) error
WaitWorkers – wait for workers final or timeout exit
func (*AppStarter) WorkTime ¶ added in v1.1.0
func (s *AppStarter) WorkTime() time.Duration
FinalThreads – wait for thread final or timeout exit
func (*AppStarter) WrapWorker ¶ added in v1.5.6
func (s *AppStarter) WrapWorker(f func())
WrapWorker – wrap worker into root workers
type CommandFunc ¶ added in v1.6.1
CommandFunc defines a function type for registered commands.
type WorkTimerCallback ¶ added in v1.1.0
func WorkTimer ¶ added in v1.1.0
func WorkTimer(start time.Time) WorkTimerCallback