Documentation
¶
Overview ¶
Package common contains commonly used functions.
Index ¶
- func FilterOutputs(outputs []*models.Output, f func(*models.Output) bool) []*models.Output
- func FilterOutputsChain(outputs []*models.Output, f func(*models.Output) bool) models.OutputSlice
- func FilterWindows(windows []*models.Window, f func(*models.Window) bool) []*models.Window
- func FilterWindowsChain(windows []*models.Window, f func(*models.Window) bool) models.WindowSlice
- func FilterWorkspaces(workspaces []*models.Workspace, f func(*models.Workspace) bool) []*models.Workspace
- func FilterWorkspacesChain(workspaces []*models.Workspace, f func(*models.Workspace) bool) models.WorkspaceSlice
- func Repr(model any) string
- func RunCommand(command string) ([]byte, error)
- func SetStringField(field reflect.Value, fieldName string, val string)
- func SetUintField(field reflect.Value, fieldName string, val any)
- func SetupLogger()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterOutputs ¶ added in v0.7.0
FilterOutputs returns a slice of output models depending on the filtering function.
func FilterOutputsChain ¶ added in v0.7.0
FilterOutputsChain is a chainable function, you can use .First() to get the first output in the slice.
func FilterWindows ¶ added in v0.7.0
FilterWindows returns a slice of window models depending on the filtering function.
func FilterWindowsChain ¶ added in v0.7.0
FilterWindowsChain is a chainable function, you can use .First() to get the first window in the slice.
func FilterWorkspaces ¶ added in v0.7.0
func FilterWorkspaces(workspaces []*models.Workspace, f func(*models.Workspace) bool) []*models.Workspace
FilterWorkspaces returns a slice of workspace models depending on the filtering function.
func FilterWorkspacesChain ¶ added in v0.7.0
func FilterWorkspacesChain(workspaces []*models.Workspace, f func(*models.Workspace) bool) models.WorkspaceSlice
FilterWorkspacesChain is a chainable function, you can use .First() to get the first workspace in the slice.
func RunCommand ¶ added in v0.9.0
RunCommand runs the given command with sh and returns the result in bytes.
func SetStringField ¶ added in v0.5.0
SetStringField is a helper function to set a string field dynamically if present.
func SetUintField ¶ added in v0.5.0
SetUintField is a helper function to set a uint64 field dynamically if present.
Note that if the field already has a value, we don't want to override it.
func SetupLogger ¶
func SetupLogger()
SetupLogger sets up the logging for the application.
The log level can be defined as the string "DEBUG", "INFO", "WARN", "ERROR", "CRITICAL" in the configuration file. E.g. "LogLevel": "INFO". Defaults to "DEBUG".
Types ¶
This section is empty.