Documentation
¶
Index ¶
- func DetectMIMEType(data *([]byte)) string
- func GenerateLockKey(identifier string) int64
- func GetEnv(key, fallback string) string
- func GetExtFromFilename(filename string) string
- func GetExtFromMIMEType(mimeType string) string
- func GetImageDimensions(imageBytes []byte) (int32, int32, error)
- func GetMimeTypeFromFilename(filename string) string
- func IsStrTruthy(s string) bool
- func JsonEscape(i string) string
- func MaybeRemoveExif(data []byte) ([]byte, error)
- func Reversed[T any](s []T) []T
- func RunWithLock(lock MutexLock, fn func() error) error
- func RunWorkerPool[T any](tasks []WorkerTask[T], maxWorkers int) chan workerResult[T]
- func RunWorkerPoolIter[T any](seq iter.Seq2[T, error], execute func(T) error, maxWorkers int) chan workerResult[T]
- func SafeDeref[T any](p *T) T
- func SafeDerefWithDefault[T any](p *T, defaultValue T) T
- func Slugify(s string, lower ...bool) string
- type Lazy
- type MutexLock
- type PgAdvisoryLock
- type RedisLock
- type SeekerReader
- type WorkerTask
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectMIMEType ¶
func GenerateLockKey ¶
func GetExtFromFilename ¶
func GetExtFromMIMEType ¶
func GetMimeTypeFromFilename ¶
func IsStrTruthy ¶
func JsonEscape ¶
func MaybeRemoveExif ¶
func RunWithLock ¶
func RunWorkerPool ¶
func RunWorkerPool[T any](tasks []WorkerTask[T], maxWorkers int) chan workerResult[T]
func RunWorkerPoolIter ¶
func RunWorkerPoolIter[T any](seq iter.Seq2[T, error], execute func(T) error, maxWorkers int) chan workerResult[T]
RunWorkerPoolIter is like RunWorkerPool but feeds jobs from an iter.Seq2 instead of a pre-built slice. The jobs channel is bounded to maxWorkers*2 so at most that many items are held in memory at once beyond what workers are actively processing. The iterator is drained in a separate goroutine; if it yields an error the error is forwarded as a result and iteration stops.
func SafeDerefWithDefault ¶
func SafeDerefWithDefault[T any](p *T, defaultValue T) T
Types ¶
type PgAdvisoryLock ¶
type PgAdvisoryLock struct {
// contains filtered or unexported fields
}
func NewPgAdvisoryLock ¶
func NewPgAdvisoryLock(db *sql.DB, lockKey int64) *PgAdvisoryLock
func (*PgAdvisoryLock) AcquireLock ¶
func (p *PgAdvisoryLock) AcquireLock() (bool, error)
func (*PgAdvisoryLock) ReleaseLock ¶
func (p *PgAdvisoryLock) ReleaseLock() error
type RedisLock ¶
type RedisLock struct {
// contains filtered or unexported fields
}
func NewRedisLock ¶
func (*RedisLock) AcquireLock ¶
func (*RedisLock) ReleaseLock ¶
type WorkerTask ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.