Documentation ¶
Index ¶
- func CatchPanic(f func() error) (err error)
- func IsLowerCaseIdentifier(id string) bool
- func IsUpperCaseIdentifier(id string) bool
- func SourceCodeSHA256(directory string) (string, error)
- func ToKebabCase(id string) string
- func ToSnakeCase(id string) string
- func ValidateConfigName(name string) error
- func ValidateHostname(hostname string) error
- func ValidateTickerName(name string) error
- type SyncMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CatchPanic ¶
CatchPanic calls the given function and returns any panic as a standard error
func IsLowerCaseIdentifier ¶
IsLowerCaseIdentifier accepts only lowerCaseIdentifiers.
func IsUpperCaseIdentifier ¶
IsUpperCaseIdentifier accepts only UpperCaseIdentifiers.
func SourceCodeSHA256 ¶
SourceCodeSHA256 generates a SHA256 of the source code files in the indicated directory and its sub-directories. The directory is interpreted relative to the current working directory. Use "." to hash the current working directory.
func ToKebabCase ¶
ToKebabCase converts a CamelCase identifier to kebab-case.
func ToSnakeCase ¶
ToSnakeCase converts a CamelCase identifier to snake_case.
func ValidateConfigName ¶
ValidateConfigName indicates if the name can be used for a config. Config names must start with a letter and contain only alphanumeric characters.
func ValidateHostname ¶
ValidateHostname indicates if the hostname is a valid microservice hostname. Hostnames must contain only alphanumeric characters, hyphens, underscores and dot separators.
func ValidateTickerName ¶
ValidateTickerName indicates if the name can be used for a ticker. Ticker names must start with a letter and contain only alphanumeric characters.
Types ¶
type SyncMap ¶
type SyncMap[K comparable, V any] struct { // contains filtered or unexported fields }
SyncMap is a map wrapped in a mutex.
func (*SyncMap[K, V]) Delete ¶
func (sm *SyncMap[K, V]) Delete(key K)
Delete deletes the value for a key.
func (*SyncMap[K, V]) Load ¶
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
func (*SyncMap[K, V]) LoadOrStore ¶
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.