util

package
v0.0.0-...-08176c1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDirExists

func EnsureDirExists(path string) error

EnsureDirExists makes sure that there exists a directory for storing the given file in the local filesystem.

func Exec

func Exec(command string) (string, error)

Exec executes a shell command using /bin/bash. Returns the output and error.

func HasCustomThumb

func HasCustomThumb(mimeType string) bool

Returns true if the server supports thumbnails for the given type.

func IsAudio

func IsAudio(mimeType string) bool

IsVideo returns true if the given mime type is a supported audio type.

func IsImage

func IsImage(mimeType string) bool

IsImage returns true if the given mime type is a supported image type.

func IsMedia

func IsMedia(mimeType string) bool

IsMedia returns true if the given mime type is a supported image or video type.

func IsPDF

func IsPDF(mimeType string) bool

IsPDF returns true if the given mime type is a PDF file.

func IsVideo

func IsVideo(mimeType string) bool

IsVideo returns true if the given mime type is a supported video type.

func ReplaceEnvs

func ReplaceEnvs(s string) string

ReplaceEnvs replaces some environment variable references with their contents. Currently supported: $HOME and $HOSTNAME.

func ShellEscape

func ShellEscape(text string) string

ShellEscape escapes a string for use in a shell command

func TypesWithCustomThumbnails

func TypesWithCustomThumbnails() []string

TypesWithCustomThumbnails retrurns mime types for which thumbnails can be generated.

func WithTransaction

func WithTransaction(ctx context.Context, db *sql.DB, f func(tx *sql.Tx) error) error

WithTransaction begin a transaction, calls a funtion and if the function retruns nil, commits the transaction. If the function returns non-nil error, the transaction is rolled back and the error is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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