Versions in this module Expand all Collapse all v0 v0.1.1 Apr 12, 2026 Changes in this version + func CleanText(s string, opts *Options) string + type Options struct + DedupLines bool + DropBoilerplateLines bool + Lowercase bool + StripMarkdown bool + StripSymbols bool v0.1.0 Apr 12, 2026 Changes in this version + const ENV_CONFIG_CACHE_EXPIRED + const ENV_CONFIG_CACHE_SIZE + const ENV_DB_DRIVER + const ENV_DSN + const FILE_TYPE_AUDIO + const FILE_TYPE_FILE + const FILE_TYPE_IMAGE + const FILE_TYPE_MEDIA + const INTERNAL_IP + const IP_API_URL + const LOCAL_NETWORK + const PCONLINE_IP_URL + const UNKNOWN + func AddDuration(d time.Duration) int64 + func AesDecrypt(key, ciphertext []byte) (buf []byte, err error) + func AesEncrypt(key, plaintext []byte) (buf []byte, err error) + func BytesToString(b []byte) string + func CalculateAge(birthday time.Time) int + func CalculateFileHash(filePath string) (string, error) + func CheckValue(db *gorm.DB, key, defaultValue, format string, autoload, public bool) + func ConfigureConnectionPool(db *gorm.DB) + func CopyFile(src, dst string) error + func Difference[T comparable](slice1, slice2 []T) []T + func EndOfDay(t time.Time) time.Time + func EnsureDirectory(path string) error + func FileExists(path string) bool + func GenerateID() string + func GetBoolEnv(key string) bool + func GetBoolValue(db *gorm.DB, key string) bool + func GetContentType(suffix string) (tp string) + func GetCrc16(val int64) uint16 + func GetDistance(lon1, lat1, lon2, lat2 float64) float64 + func GetEnv(key string) string + func GetFileSize(filePath string) (int64, error) + func GetFileType(buf []byte) (fileType string) + func GetFileTypeBySuffix(suffix string) int32 + func GetFloatEnv(key string) float64 + func GetFloatEnvWithDefault(key string, defaultValue float64) float64 + func GetIntEnv(key string) int64 + func GetIntEnvWithDefault(key string, defaultValue int) int + func GetIntValue(db *gorm.DB, key string, defaultVal int) int + func GetLocationByIP(ip string) (country, city, location string) + func GetLocationByIPWithPconline(ip string) (country, city, location string) + func GetRealAddressByIP(ip string) string + func GetValue(db *gorm.DB, key string) string + func InArray[T comparable](needle T, haystack []T) bool + func InitDatabase(logWrite io.Writer, driver, dsn string) (*gorm.DB, error) + func InitGlobalCache(maxSize int, expiration time.Duration) + func Intersect[T comparable](slice1, slice2 []T) []T + func IsDirectory(path string) bool + func IsFile(path string) bool + func IsInternalIP(ip string) bool + func Join[T any](arg []T, str string) string + func LoadAutoloads(db *gorm.DB) + func LoadEnv(env string) error + func LoadEnvs(objPtr any) + func LookupEnv(key string) (value string, found bool) + func MD5(str string) string + func MakeMigrates(db *gorm.DB, insts []any) error + func Merge[T any](slice1, slice2 []T) []T + func MillisFromTime(t time.Time) int64 + func NowUnix() int64 + func RC4Decrypt(str string, key []byte) string + func RC4Encrypt(str string, key []byte) string + func ReadFile(filename string) ([]byte, error) + func RemoveDirectory(path string) error + func RemoveFile(path string) error + func SetIPServiceLogger(logger *zap.Logger) + func SetIPServiceTimeout(timeout time.Duration) + func SetValue(db *gorm.DB, key, value, format string, autoload, public bool) + func SixteenMD5(str string) string + func StartOfDay(t time.Time) time.Time + func StringToBytes(s string) []byte + func TimeFromMillis(millis int64) time.Time + func UnZlib(in []byte) (out []byte) + func Unique[T comparable](slice []T) []T + func WriteFile(filename string, data []byte) error + func Yesterday() time.Time + func Zlib(in []byte) (out []byte) + type Config struct + Autoload bool + CreatedAt time.Time + Desc string + Format string + ID uint + Key string + Public bool + UpdatedAt time.Time + Value string + func LoadPublicConfigs(db *gorm.DB) []Config + type ExpiredLRUCache struct + var GlobalCache *ExpiredLRUCache[string, any] + func NewExpiredLRUCache[K comparable, V any](size int, expired time.Duration) *ExpiredLRUCache[K, V] + func (c *ExpiredLRUCache[K, V]) Add(key K, value V) (evicted bool) + func (c *ExpiredLRUCache[K, V]) Contains(key K) bool + func (c *ExpiredLRUCache[K, V]) Get(key K) (value V, ok bool) + func (c *ExpiredLRUCache[K, V]) Remove(key K) (present bool) + type IPGeolocationResponse struct + AS string + City string + Country string + CountryCode string + ISP string + Lat float64 + Lon float64 + Message string + Org string + Query string + Region string + Status string + Timezone string + type IPLocationResponse struct + City string + Pro string + type IPLocationService struct + func NewIPLocationService(logger *zap.Logger) *IPLocationService + func NewIPLocationServiceWithPconline(logger *zap.Logger) *IPLocationService + func (ils *IPLocationService) GetLocation(ip string) (country, city, location string, err error) + type Snowflake struct + var SnowflakeUtil *Snowflake + func NewSnowflake() (*Snowflake, error) + func (sf *Snowflake) GenID() string + func (sf *Snowflake) NextID() int64