util

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddQueryString

func AddQueryString(u, k, v string) string

AddQueryString method to add the given query string key value pair appropriately to the given URL string.

func DetectFileContentType

func DetectFileContentType(file string, content io.ReadSeeker) (string, error)

DetectFileContentType method to identify the static file content-type. It's similar to http.DetectContentType but has windows OS and corner case covered.

func FirstNonEmpty

func FirstNonEmpty(values ...string) string

FirstNonEmpty method returns the first non-empty string from given var args otherwise empty string.

func FuncEqual

func FuncEqual(a, b interface{}) bool

FuncEqual method to compare to function callback interface data. In effect comparing the pointers of the indirect layer. Read more about the representation of functions here: http://golang.org/s/go11func

func IsGzipWorthForFile

func IsGzipWorthForFile(name string) bool

IsGzipWorthForFile method to decide whether gzipping file content it worth to do by checking file extension. If its worth to do it returns true otherwise false.

func IsValidTimeUnit

func IsValidTimeUnit(str string, units ...string) bool

IsValidTimeUnit method to check supported time unit suffixes. If supported returns true otherwise false.

func MimeTypeByExtension

func MimeTypeByExtension(ext string) string

MimeTypeByExtension method to get MIME info by file extension with corner case covered since mime.TypeByExtension behaves wired on windows for `.js` and `.css`, it better to have some basic measure

func OnlyMIME

func OnlyMIME(ct string) string

OnlyMIME method to strip everything after `;` from the content type value.

func SanitizeValue

func SanitizeValue(value interface{}) interface{}

SanitizeValue method to sanatizes type `string`, rest we can't do any. It's a user responbility.

Types

This section is empty.

Jump to

Keyboard shortcuts

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