Documentation ¶
Index ¶
- func Avg(values []float64) float64
- func Backup(db *sql.DB, backupFile string)
- func CleanupDirectory(path string)
- func Copy(source, destination string) error
- func DecodeBase64Image(url string) (bytes []byte, extension string, err error)
- func DoesFileExists(name string) bool
- func FindInSlice(slice []string, val string) (int, bool)
- func Float64MapToSlice(float64Map map[string]float64) []float64
- func GenerateAccessToken() (string, error)
- func GenerateClientIDFromRequest(req *http.Request) string
- func GeneratePhrase() string
- func GenerateRandomDisplayColor(maxColor int) int
- func GenerateRandomString(n int) (string, error)
- func GetAveragePerformance(key string) float64
- func GetCacheDurationSecondsForPath(filePath string) int
- func GetHashtagsFromText(text string) []string
- func GetHostnameFromURL(u url.URL) string
- func GetHostnameFromURLString(s string) string
- func GetHostnameWithoutPortFromURLString(s string) string
- func GetIPAddressFromRequest(req *http.Request) string
- func GetIndexFromFilePath(path string) string
- func GetRelativePathFromAbsolutePath(path string) string
- func IntPercentage(x, total int) int
- func IsHostnameInternal(hostname string) bool
- func IsUserAgentABot(userAgent string) bool
- func IsUserAgentAPlayer(userAgent string) bool
- func IsValidURL(urlToTest string) bool
- func MakeSafeStringOfLength(s string, length int) string
- func Median(input []float64) float64
- func MigrateCustomEmojiLocations()
- func MinMax(array []float64) (float64, float64)
- func Move(source, destination string) error
- func RandomIndex(max int) int
- func ReadRestURLParameter(r *http.Request, parameterName string) (string, error)
- func RenderPageContentMarkdown(raw string) string
- func RenderSimpleMarkdown(raw string) string
- func RestEndpoint(pattern string, handler http.HandlerFunc) (string, http.HandlerFunc)
- func Restore(backupFile string, databaseFile string) error
- func ShuffleStringSlice(s []string) []string
- func StartPerformanceMonitor(key string)
- func StringMapKeys(stringMap map[string]interface{}) []string
- func StringSliceToMap(stringSlice []string) map[string]interface{}
- func StripHTML(s string) string
- func Sum(values []float64) float64
- func ValidatedFfmpegPath(ffmpegPath string) string
- func VerifyFFMpegPath(path string) error
- type NullTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Backup ¶ added in v0.0.6
Backup will backup the provided instance of the database to the specified file.
func CleanupDirectory ¶ added in v0.0.8
func CleanupDirectory(path string)
CleanupDirectory removes the directory and makes it fresh again. Throws fatal error on failure.
func DecodeBase64Image ¶ added in v0.1.0
DecodeBase64Image decodes a base64 image string into a byte array, returning the extension (including dot) for the content type.
func DoesFileExists ¶
DoesFileExists checks if the file exists.
func FindInSlice ¶ added in v0.0.8
FindInSlice will return if a string is in a slice, and the index of that string.
func Float64MapToSlice ¶ added in v0.0.12
Float64MapToSlice is a convenience function to convert a map of floats into.
func GenerateAccessToken ¶ added in v0.0.6
GenerateAccessToken will generate and return an access token.
func GenerateClientIDFromRequest ¶
GenerateClientIDFromRequest generates a client id from the provided request.
func GeneratePhrase ¶ added in v0.0.8
func GeneratePhrase() string
GeneratePhrase will generate and return a random string consisting of our word list.
func GenerateRandomDisplayColor ¶ added in v0.0.8
GenerateRandomDisplayColor will return a random number that is used for referencing a color value client-side. These colors are seen as --theme-user-colors-n.
func GenerateRandomString ¶ added in v0.1.0
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GetAveragePerformance ¶
GetAveragePerformance will return the average durations for the event.
func GetCacheDurationSecondsForPath ¶
GetCacheDurationSecondsForPath will return the number of seconds to cache an item.
func GetHashtagsFromText ¶ added in v0.0.11
GetHashtagsFromText returns all the #Hashtags from a string.
func GetHostnameFromURL ¶ added in v0.0.11
GetHostnameFromURL will return the hostname component from a URL string.
func GetHostnameFromURLString ¶ added in v0.0.11
GetHostnameFromURLString will return the hostname component from a URL object.
func GetHostnameWithoutPortFromURLString ¶ added in v0.1.2
GetHostnameWithoutPortFromURLString will return the hostname component without the port from a URL object.
func GetIPAddressFromRequest ¶
GetIPAddressFromRequest returns the IP address from a http request.
func GetIndexFromFilePath ¶
GetIndexFromFilePath is a utility that will return the index/key/variant name in a full path.
func GetRelativePathFromAbsolutePath ¶
GetRelativePathFromAbsolutePath gets the relative path from the provided absolute path.
func IntPercentage ¶ added in v0.0.12
IntPercentage returns an int percentage of a number.
func IsHostnameInternal ¶ added in v0.1.2
IsHostnameInternal will attempt to determine if the hostname is internal to this server's network or is the loopback address.
func IsUserAgentABot ¶
IsUserAgentABot returns if a web client user-agent is seen as a bot.
func IsUserAgentAPlayer ¶ added in v0.0.9
IsUserAgentAPlayer returns if a web client user-agent is seen as a media player.
func IsValidURL ¶ added in v0.0.9
IsValidURL will return if a URL string is a valid URL or not.
func MakeSafeStringOfLength ¶ added in v0.1.0
MakeSafeStringOfLength will take a string and strip HTML tags, trim whitespace, and limit the length.
func MigrateCustomEmojiLocations ¶ added in v0.1.0
func MigrateCustomEmojiLocations()
MigrateCustomEmojiLocations migrates custom emoji from the old location to the new location.
func RandomIndex ¶ added in v0.0.11
RandomIndex returns a random integer that is at most the `max` parameter.
func ReadRestURLParameter ¶ added in v0.0.9
ReadRestURLParameter will return the parameter from the request of the requested name.
func RenderPageContentMarkdown ¶ added in v0.0.6
RenderPageContentMarkdown will return HTML specifically handled for the user-specified page content.
func RenderSimpleMarkdown ¶
RenderSimpleMarkdown will return HTML without sanitization or specific formatting rules.
func RestEndpoint ¶ added in v0.0.9
func RestEndpoint(pattern string, handler http.HandlerFunc) (string, http.HandlerFunc)
RestEndpoint wraps a handler to use the rest endpoint helper.
func Restore ¶ added in v0.0.6
Restore will attempt to restore the database using a specified backup file.
func ShuffleStringSlice ¶ added in v0.0.12
ShuffleStringSlice will shuffle a slice of strings.
func StartPerformanceMonitor ¶
func StartPerformanceMonitor(key string)
StartPerformanceMonitor will keep track of the start time of this event.
func StringMapKeys ¶ added in v0.0.11
StringMapKeys returns a slice of string keys from a map.
func StringSliceToMap ¶ added in v0.0.11
StringSliceToMap is a convenience function to convert a slice of strings into a map using the string as the key.
func ValidatedFfmpegPath ¶ added in v0.0.6
ValidatedFfmpegPath will take a proposed path to ffmpeg and return a validated path.
func VerifyFFMpegPath ¶ added in v0.0.6
VerifyFFMpegPath verifies that the path exists, is a file, and is executable.
Types ¶
type NullTime ¶
NullTime is a custom nullable time for representing datetime.
func (NullTime) MarshalJSON ¶
MarshalJSON implements the JSON marshal function.
func (NullTime) UnmarshalJSON ¶
UnmarshalJSON implements the JSON unmarshal function.