common

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package common contains commonly used functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterOutputs added in v0.7.0

func FilterOutputs(outputs []*models.Output, f func(*models.Output) bool) []*models.Output

FilterOutputs returns a slice of output models depending on the filtering function.

func FilterOutputsChain added in v0.7.0

func FilterOutputsChain(outputs []*models.Output, f func(*models.Output) bool) models.OutputSlice

FilterOutputsChain is a chainable function, you can use .First() to get the first output in the slice.

func FilterWindows added in v0.7.0

func FilterWindows(windows []*models.Window, f func(*models.Window) bool) []*models.Window

FilterWindows returns a slice of window models depending on the filtering function.

func FilterWindowsChain added in v0.7.0

func FilterWindowsChain(windows []*models.Window, f func(*models.Window) bool) models.WindowSlice

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 Repr

func Repr(model any) string

Repr returns the name of the given model.

This can be used to print out the model name.

func RunCommand added in v0.9.0

func RunCommand(command string) ([]byte, error)

RunCommand runs the given command with sh and returns the result in bytes.

func SetStringField added in v0.5.0

func SetStringField(field reflect.Value, fieldName string, val string)

SetStringField is a helper function to set a string field dynamically if present.

func SetUintField added in v0.5.0

func SetUintField(field reflect.Value, fieldName string, val any)

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.

Jump to

Keyboard shortcuts

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