util

package
v0.1.0-beta.202310060640 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base36ID

func Base36ID(key string, input string, length int) (string, error)

Base36ID returns a base36 hash of the input string, using the provided key. Our approach is lossy using only part of the true hash, but good enough for our purposes to prevent clashes.

func Base36IDPerMachine

func Base36IDPerMachine(input string, length int) (string, error)

Base36IDPerMachine returns a base36 hash of the input string, using the machine ID as key. This means the same input will return the same hash on the same machine. Useful for unique IDs in a distributed system.

func CalculateHash

func CalculateHash(s, salt string) string

func ContextWithSession

func ContextWithSession(ctx context.Context) context.Context

ContextWithSession returns a new context with a new session ID.

func ContextWithSessionID

func ContextWithSessionID(ctx context.Context, sessionID string) context.Context

ContextWithSessionID returns a new context with the given session ID. This is useful for testing.

func NewExecutionID

func NewExecutionID() string

func NewPipelineExecutionID

func NewPipelineExecutionID() string

func NewProcessID

func NewProcessID() string

func NewSessionID

func NewSessionID() string

func NewStepExecutionID

func NewStepExecutionID() string

func NewUniqueID

func NewUniqueID() string

func NodeID

func NodeID(port string) (string, error)

func Session

func Session(ctx context.Context) string

Session returns the session ID from the context.

Types

type SessionContextKey

type SessionContextKey struct{}

Jump to

Keyboard shortcuts

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