Documentation ¶
Index ¶
- func ExtractFilePath(url string) (string, string, string)
- func Filter(str string, search string) string
- func FormInteger(r *http.Request, name string) int
- func GetExtension(filename *string) string
- func GetStringArray(r *http.Request, name string) []string
- func LastURLParameter(r *http.Request) string
- func MaxParallelism() int
- func RemoveFromStringArray(arr *[]string, elem string)
- func RemoveFromStringArrayIndex(arr *[]string, elem int)
- func ToFriendly(s string) string
- type CacheObject
- type CacheStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractFilePath ¶
ExtractFilePath goes from "https://aa.bb/abc/def.ghi?jkl=mnp&qrs=tuv" to ("abc/", "def", "ghi")
func GetExtension ¶
GetExtension goes from "https://aa.bb/abc/def.ghi?jkl=mnp&qrs=tuv" to "ghi"
func GetStringArray ¶
GetStringArray tries to retrieve the context.Get(r, name) value as an []string
func LastURLParameter ¶
LastURLParameter treats everything after the last slash (up until the question mark) as parameter-value
func MaxParallelism ¶
func MaxParallelism() int
MaxParallelism runs the maximum number of goroutines that should be created
func RemoveFromStringArray ¶
func ToFriendly ¶
ToFriendly converts a string to a HTML-friendly version. Replaces &, /, and space. Trims dashes and slashes.
Types ¶
type CacheObject ¶
type CacheObject struct { // Expires is the expiration-interval after which the object should be fetched again Expires time.Duration // Fetch is the function that retrieves the value from the source Fetch func() interface{} // contains filtered or unexported fields }
func NewCacheObject ¶
func NewCacheObject(exp time.Duration, f func() interface{}) CacheObject
func (*CacheObject) Val ¶
func (o *CacheObject) Val() interface{}
Val fetches the actual value from source using the Fetch function - only when needed.
type CacheStorage ¶
type CacheStorage struct {
// contains filtered or unexported fields
}
func NewCacheStorage ¶
func NewCacheStorage(cacheDir string) *CacheStorage
func (*CacheStorage) Add ¶
func (c *CacheStorage) Add(urlPath, requestUrl string)
func (*CacheStorage) Delete ¶
func (c *CacheStorage) Delete(urlPath string)
func (*CacheStorage) Exists ¶
func (c *CacheStorage) Exists(urlPath, requestUrl string) bool
Click to show internal directories.
Click to hide internal directories.