Documentation
¶
Index ¶
- Variables
- func AnyQueue() workflow.Queue
- func BuildOptionArgs(options map[string]string) []string
- func Clean(s string) string
- func ClonePointer[T any](v *T) *T
- func FromPointer[T comparable](v *T) T
- func HostQueue(hostID string) workflow.Queue
- func ManagerQueue() workflow.Queue
- func NillablePointerTo[T comparable](v T) *T
- func PointerTo[T any](v T) *T
- func RandomString(length int) (string, error)
- func Retry(maxAttempts int, initialDelay time.Duration, f func() error) error
- func SleepContext(ctx context.Context, duration time.Duration) error
- func TypedFromMap[T any](m map[string]any, key string) (T, bool)
- func ValidateID(value string) error
- func WithTimeout(ctx context.Context, timeout time.Duration, f func(ctx context.Context) error) error
- type LineWriter
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidIdentifier = errors.New(`valid IDs must be 1-36 characters long, contain only lowercase letters, digits, and hyphens, start and end with a letter or digit, and not contain two consecutive hyphens`)
var ErrTimedOut = errors.New("operation timed out")
Functions ¶
func BuildOptionArgs ¶
func ClonePointer ¶
func ClonePointer[T any](v *T) *T
func FromPointer ¶
func FromPointer[T comparable](v *T) T
FromPointer dereferences the input pointer if it's non-nil or returns the zero value for T if the pointer is nil.
func ManagerQueue ¶
func NillablePointerTo ¶
func NillablePointerTo[T comparable](v T) *T
NillablePointerTo returns a pointer to v if v is not the zero value of its type, otherwise it returns nil.
func RandomString ¶
func Retry ¶
Retry retries the given function up to maxAttempts times with an exponential backoff starting at initialDelay.
func SleepContext ¶ added in v0.8.0
func TypedFromMap ¶ added in v0.9.0
TypedFromMap reads a typed value from the given map. If the value does not exist or does not match the given type, it will return the zero value for the type and 'false'.
func ValidateID ¶
Types ¶
type LineWriter ¶
type LineWriter struct {
// contains filtered or unexported fields
}
LineWriter is an io.Writer that buffers input until a newline is seen. When a newline is encountered, it calls the provided emit function with the line (without the newline).
func NewLineWriter ¶
func NewLineWriter(emit func([]byte) error) *LineWriter
NewLineWriter creates a new LineWriter with the given emit function. The emit function is called whenever a full line is buffered (newline is removed).
func (*LineWriter) Close ¶
func (w *LineWriter) Close() error
Close forces the buffered data to be emitted, even if no newline is present.