Documentation ¶
Index ¶
- Variables
- func ArrayFromString(values string, separator string) []string
- func ArrayToString(values []string, separator string) string
- func CheckPasswordHash(password, hash string) bool
- func Contains[K comparable](a []K, x K) bool
- func DeleteEmptyStrings(s []string) []string
- func FileExists(filename string) bool
- func FormatDate(date time.Time) string
- func GenerateETag(str string, weak bool) string
- func GetAvatar(name, login, email string, size int, palette []color.Color, random bool) []byte
- func GetErrorDescription(bodyBytes []byte) string
- func GetHash(data []byte) string
- func GetRemoteBytes(url, username, password string, addHeaders map[string]string, body []byte) ([]byte, int, error)
- func GetRemoteFile(url, username, password string, addHeaders map[string]string, outPath string) error
- func GetRemoteSmallFile(url, username, password string, addHeaders map[string]string, outPath string) (int, error)
- func GetUA() string
- func GetVersion() string
- func HashPassword(password string) (string, error)
- func IsDirEmpty(name string) (bool, error)
- func IsDirectory(path string) (bool, error)
- func IsZeroTime(t time.Time) bool
- func PostRemoteBytes(url, username, password string, addHeaders map[string]string, data interface{}) ([]byte, int, error)
- func PostRemoteForm(url, username, password string, addHeaders map[string]string, data url.Values) ([]byte, error)
- func PostRemoteSmallFile(url, username, password string, addHeaders map[string]string, ...) ([]byte, int, error)
- func PutRemoteBytes(url, username, password string, addHeaders map[string]string, data interface{}) ([]byte, int, error)
- func QueryParameterFloat(gc *gin.Context, name string, defaultVal float64) float64
- func QueryParameterInt(gc *gin.Context, name string, defaultVal int) int
- func QueryParameterString(gc *gin.Context, name, defaultVal string) string
- func RandomKey(n int) (string, error)
- func RemoveItem(slice []string, index int) []string
- func StringToDate(date string, defaultVal time.Time) time.Time
- type LockCache
- func (lc *LockCache[K]) Free()
- func (lc *LockCache[K]) Get(key K) (m *LockMutex, ok bool)
- func (lc *LockCache[K]) Init()
- func (lc *LockCache[K]) Lock(key K, duration time.Duration)
- func (lc *LockCache[K]) RLock(key K, duration time.Duration)
- func (lc *LockCache[K]) RUnlock(key K)
- func (lc *LockCache[K]) Set(key K, m *LockMutex)
- func (lc *LockCache[K]) TryLock(key K, duration time.Duration) bool
- func (lc *LockCache[K]) TryRLock(key K, duration time.Duration) bool
- func (lc *LockCache[K]) Unlock(key K)
- type LockMutex
Constants ¶
This section is empty.
Variables ¶
InfinityDate Infinity date
OutDate Default date
Functions ¶
func ArrayFromString ¶
ArrayFromString Create array of values from separated string
func ArrayToString ¶
ArrayToString Create separated string from array values
func CheckPasswordHash ¶
CheckPasswordHash Check password hash
func Contains ¶ added in v1.1.0
func Contains[K comparable](a []K, x K) bool
Contains check value present in array
func DeleteEmptyStrings ¶ added in v1.1.0
DeleteEmptyStrings return string slice without empty strings
func GenerateETag ¶ added in v0.10.3
Generates an Etag for given string. Allows specifying whether to generate weak Etag or not as second parameter
func GetErrorDescription ¶ added in v1.5.2
GetErrorDescription get error from body
func GetRemoteBytes ¶ added in v0.7.0
func GetRemoteBytes(url, username, password string, addHeaders map[string]string, body []byte) ([]byte, int, error)
GetRemoteBytes Get remote data with timeout
func GetRemoteFile ¶ added in v1.4.0
func GetRemoteFile(url, username, password string, addHeaders map[string]string, outPath string) error
GetRemoteFile Get remote data with big timeout and write to file
func GetRemoteSmallFile ¶ added in v0.15.0
func GetRemoteSmallFile(url, username, password string, addHeaders map[string]string, outPath string) (int, error)
GetRemoteSmallFile Get remote data with timeout and write to file
func HashPassword ¶
HashPassword Create hash from password
func IsDirectory ¶ added in v0.2.0
IsDirectory Is path directory
func IsZeroTime ¶ added in v0.10.3
IsZeroTime Check if time is not init
func PostRemoteBytes ¶ added in v0.9.0
func PostRemoteBytes(url, username, password string, addHeaders map[string]string, data interface{}) ([]byte, int, error)
PostRemoteBytes Post remote data with timeout
func PostRemoteForm ¶ added in v1.5.0
func PostRemoteForm(url, username, password string, addHeaders map[string]string, data url.Values) ([]byte, error)
PostRemoteForm Post remote form with timeout
func PostRemoteSmallFile ¶ added in v0.16.0
func PostRemoteSmallFile(url, username, password string, addHeaders map[string]string, filePath, dstFileName string) ([]byte, int, error)
PostRemoteSmallFile Post remote data with timeout
func PutRemoteBytes ¶ added in v0.9.0
func PutRemoteBytes(url, username, password string, addHeaders map[string]string, data interface{}) ([]byte, int, error)
PutRemoteBytes Put remote data with timeout
func QueryParameterFloat ¶ added in v1.7.0
QueryParameterFloat Return query parameter as Float or default value
func QueryParameterInt ¶ added in v0.3.0
QueryParameterInt Return query parameter as Int or default value
func QueryParameterString ¶ added in v0.3.0
QueryParameterString Return query parameter or default value
func RemoveItem ¶
RemoveItem Remove item from slice at index
Types ¶
type LockCache ¶ added in v1.1.0
type LockCache[K comparable] struct { // contains filtered or unexported fields }
LockCache lock cache with expire support
func (*LockCache[K]) Free ¶ added in v1.1.0
func (lc *LockCache[K]) Free()
Free free unused resources
func (*LockCache[K]) RUnlock ¶ added in v1.8.0
func (lc *LockCache[K]) RUnlock(key K)
RUnlock unlock read mutex by key