Documentation
¶
Overview ¶
Package util contains various general utility functions used throughout the project.
Index ¶
- func CopyFile(path string, writer io.Writer) error
- func HashBuffer(buf []byte) (string, error)
- func IDToString(id int64) string
- func LogError(ip string, err error)
- func RandomID(length int) string
- func Waterfall(fns []func() error) (err error)
- func WrapError(text string, err error) error
- type AtomicCloser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashBuffer ¶
HashBuffer computes a truncated MD5 hash from a buffer
func IDToString ¶
IDToString is a helper for converting a post ID to a string for JSON keys
func RandomID ¶
RandomID generates a randomID of uppercase and lowercase letters and numbers of desired length
Types ¶
type AtomicCloser ¶
AtomicCloser is a simple boolean guarded by a mutex for atomically managing a shared close/open state from multiple goroutines. Can be safely emebedded into other structs.
func (*AtomicCloser) IsOpen ¶
func (a *AtomicCloser) IsOpen() bool
IsOpen returns, if AtomicCloser is still open
Click to show internal directories.
Click to hide internal directories.