Documentation ¶
Overview ¶
Package utils provides reusable and sharable utilities for other packages and components.
Index ¶
- func DeSerializeJob(jobBytes []byte) (*work.Job, error)
- func DirExists(path string) bool
- func FileExists(file string) bool
- func GenerateNodeID() string
- func IsEmptyStr(str string) bool
- func IsValidPort(port uint) bool
- func IsValidURL(address string) bool
- func MakeIdentifier() string
- func ReadEnv(key string) string
- func ResolveHostnameAndIP() (string, error)
- func SerializeJob(job *work.Job) ([]byte, error)
- func TranslateRedisAddress(commaFormat string) (string, bool)
- type NodeIDContextKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeSerializeJob ¶
DeSerializeJob decodes bytes to ptr of work.Job.
func IsEmptyStr ¶
IsEmptyStr check if the specified str is empty (len ==0) after triming prefix and suffix spaces.
func IsValidURL ¶
IsValidURL validates if the url is well-formted
func ResolveHostnameAndIP ¶
ResolveHostnameAndIP gets the local hostname and IP
func SerializeJob ¶
SerializeJob encodes work.Job to json data.
func TranslateRedisAddress ¶
TranslateRedisAddress translates the comma format to redis URL
Types ¶
type NodeIDContextKey ¶
type NodeIDContextKey string
NodeIDContextKey is used to keep node ID in the system context
const ( // NodeID is const of the ID context key NodeID NodeIDContextKey = "node_id" )
Click to show internal directories.
Click to hide internal directories.