Documentation ¶
Index ¶
- func ArrayFilter(s []string) []string
- func GetCurrentSeason() string
- func GetSeasonName(m int) string
- func GetValueFromRedis(client *redis.Client, key string) (value string, err error)
- func GetValueFromSplit(str string, separator string, index int) string
- func ImageURLCleaner(str string) string
- func InArray(arr []string, v string) bool
- func SaveToRedis(client *redis.Client, key string, value interface{}, expiredTime time.Duration) error
- func SetSearchParams(u *url.URL, queryObj model.Query) url.Values
- func StrToFloat(strNum string) float64
- func StrToNum(strNum string) int
- func URLCleaner(str string, URLType string, isNeeded ...bool) string
- func UnmarshalFromRedis(client *redis.Client, key string, model interface{}) (isFound bool, err error)
- func VideoURLCleaner(str string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayFilter ¶
ArrayFilter to remove empty string from slice.
func GetCurrentSeason ¶
func GetCurrentSeason() string
GetCurrentSeason to get current season (spring, summer, fall, winter).
func GetSeasonName ¶
GetSeasonName to get season name (spring, summer, fall, winter).
func GetValueFromRedis ¶ added in v0.2.0
GetValueFromRedis to get value from redis. Assume redis is already connected.
func GetValueFromSplit ¶
GetValueFromSplit to get value from splitted string.
func ImageURLCleaner ¶
ImageURLCleaner to clean dirty image url. Example: https://cdn.myanimelist.net/r/80x120/images/manga/3/214566.jpg?s=48212bcd0396d503a01166149a29c67e => https://cdn.myanimelist.net/images/manga/3/214566.jpg https://cdn.myanimelist.net/r/76x120/images/userimages/6098374.jpg?s=4b8e4f091fbb3ecda6b9833efab5bd9b => https://cdn.myanimelist.net/images/userimages/6098374.jpg https://cdn.myanimelist.net/r/76x120/images/questionmark_50.gif?s=8e0400788aa6af2a2f569649493e2b0f => empty string
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 ¶
SetSearchParams to set search params for search anime and manga.
func StrToFloat ¶
StrToFloat to convert string number to float64.
func StrToNum ¶
StrToNum to convert string number to integer including comma removal (1,234 -> 1234).
func URLCleaner ¶ added in v0.2.0
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.
func VideoURLCleaner ¶
VideoURLCleaner to clean dirty video url. Example: https://www.youtube.com/embed/qig4KOK2R2g?enablejsapi=1&wmode=opaque&autoplay=1 => https://www.youtube.com/watch?v=qig4KOK2R2g https://www.youtube.com/embed/j2hiC9BmJlQ?enablejsapi=1&wmode=opaque&autoplay=1 => https://www.youtube.com/watch?v=j2hiC9BmJlQ
Types ¶
This section is empty.