toolkit

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesUUID

func BytesUUID(input []byte) (uuid.UUID, bool)

BytesUUID – generates uuid (v5) from bytes array

func ExecuteCommand added in v1.6.1

func ExecuteCommand(name string, args ...string) (error, bool)

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

func ObjectUUID(object any) (uuid.UUID, bool)

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

func RunAdditional() (error, bool)

func StringUUID

func StringUUID(input string) (uuid.UUID, bool)

StringUUID – generates uuid (v5) from string value

Types

type AppStarter

type AppStarter struct {
	Context context.Context
	// contains filtered or unexported fields
}

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) Wait

func (s *AppStarter) Wait()

Wait – waiting for app root context done

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

type CommandFunc func(args ...string) error

CommandFunc defines a function type for registered commands.

type WorkTimerCallback added in v1.1.0

type WorkTimerCallback func() time.Duration

func WorkTimer added in v1.1.0

func WorkTimer(start time.Time) WorkTimerCallback

Jump to

Keyboard shortcuts

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