utils

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayFilter

func ArrayFilter(s []string) []string

ArrayFilter to remove empty string from slice.

func GetCurrentSeason

func GetCurrentSeason() string

GetCurrentSeason to get current season (spring, summer, fall, winter).

func GetSeasonName

func GetSeasonName(m int) string

GetSeasonName to get season name (spring, summer, fall, winter).

func GetValueFromRedis added in v0.2.0

func GetValueFromRedis(client *redis.Client, key string) (value string, err error)

GetValueFromRedis to get value from redis. Assume redis is already connected.

func GetValueFromSplit

func GetValueFromSplit(str string, separator string, index int) string

GetValueFromSplit to get value from splitted string.

func InArray

func InArray(arr []string, v string) bool

InArray to get if value is in array.

func SaveToRedis added in v0.2.0

func SaveToRedis(client *redis.Client, key string, value interface{}, expiredTime time.Duration) error

SaveToRedis to save value to redis. Assume redis is already connected.

func SetSearchParams

func SetSearchParams(u *url.URL, queryObj model.Query) url.Values

SetSearchParams to set search params for search anime and manga.

func StrToFloat

func StrToFloat(strNum string) float64

StrToFloat to convert string number to float64.

func StrToNum

func StrToNum(strNum string) int

StrToNum to convert string number to integer including comma removal (1,234 -> 1234).

func URLCleaner added in v0.2.0

func URLCleaner(str string, URLType string, isNeeded ...bool) string

URLCleaner is wrapper for image and video url cleaner for easier call.

func UnmarshalFromRedis added in v0.2.0

func UnmarshalFromRedis(client *redis.Client, key string, model interface{}) (isFound bool, err error)

UnmarshalFromRedis to unmarshal redis value to model.

Types

This section is empty.

Jump to

Keyboard shortcuts

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