Versions in this module Expand all Collapse all v0 v0.1.0 Oct 25, 2025 Changes in this version + func Base64Decode(encoded string) (string, error) + func Base64Encode(data string) string + func Base64URLDecode(encoded string) (string, error) + func Base64URLEncode(data string) string + func CalculateOffset(page, pageSize int) int + func Chunk(slice interface{}, chunkSize int) interface + func Clamp(value, min, max int) int + func Contains(s, substr string) bool + func ContainsAny(s string, substrings []string) bool + func Filter(slice interface{}, predicate func(interface{}) bool) interface + func FormatBytes(bytes int64) string + func FormatDuration(d time.Duration) string + func GenerateKey() (string, error) + func GenerateRandomBytes(length int) ([]byte, error) + func GenerateRandomString(length int) (string, error) + func GenerateSecret() (string, error) + func GetPaginationLinks(meta PaginationMeta, baseURL string) map[string]interface + func GetSortString(sortFields []SortField) string + func IsEmpty(s string) bool + func IsNotEmpty(s string) bool + func IsStrongPassword(password string) bool + func IsValidEmail(email string) bool + func IsValidPhoneNumber(phone string) bool + func IsValidURL(url string) bool + func IsValidUUID(uuid string) bool + func Map(slice interface{}, mapper func(interface{}) interface{}) interface + func Max(a, b int) int + func Min(a, b int) int + func ParseBool(s string, defaultValue bool) bool + func ParseFloat(s string, defaultValue float64) float64 + func ParseInt(s string, defaultValue int) int + func Reduce(slice interface{}, initial interface{}, ...) interface + func RemoveDuplicates(slice []string) []string + func Round(value float64, places int) float64 + func Sign(data, secret string) string + func SliceContains(slice interface{}, value interface{}) bool + func SortSlice(slice interface{}, sortFields []SortField) error + func SortStructs(slice interface{}, sortFields []SortField) error + func TimeAgo(t time.Time) string + func Truncate(s string, length int) string + func TruncateWords(s string, wordCount int) string + func ValidatePaginationRequest(req *PaginationRequest, config *PaginationConfig) error + func ValidateSortFields(sortFields []SortField, config *SortConfig) error + func Verify(password, hash string, config *HashConfig) (bool, error) + func VerifySignature(data, signature, secret string) bool + type DecryptResult struct + Data string + Error string + Valid bool + func Decrypt(encryptedData, signature, nonce string, config *EncryptionConfig) (*DecryptResult, error) + func DecryptWithPassword(encryptedData, signature, nonce, password string) (*DecryptResult, error) + type EncryptResult struct + Data string + Nonce string + Signature string + func Encrypt(data string, config *EncryptionConfig) (*EncryptResult, error) + func EncryptWithPassword(data, password string) (*EncryptResult, error) + type EncryptionConfig struct + Key string + Secret string + func NewEncryptionConfig() (*EncryptionConfig, error) + func NewEncryptionConfigWithKey(key, secret string) *EncryptionConfig + type HashAlgorithm string + const Argon2 + const Bcrypt + const HMAC + const SHA256 + const SHA512 + type HashConfig struct + Algorithm HashAlgorithm + Cost int + KeyLength uint32 + Memory uint32 + Secret string + Threads uint8 + Time uint32 + func DefaultHashConfig() *HashConfig + type HashResult struct + Algorithm HashAlgorithm + Config *HashConfig + Hash string + Salt string + func Hash(password string, config *HashConfig) (*HashResult, error) + type PaginationConfig struct + DefaultPageSize int + DefaultSortBy string + DefaultSortDir string + MaxPageSize int + MinPageSize int + func DefaultPaginationConfig() *PaginationConfig + type PaginationMeta struct + HasNext bool + HasPrev bool + NextPage *int + Page int + PageSize int + PrevPage *int + Total int64 + TotalPages int + func CalculatePaginationMeta(page, pageSize int, total int64) PaginationMeta + type PaginationRequest struct + Page int + PageSize int + SortBy string + SortDir string + func ParsePaginationRequest(pageStr, pageSizeStr, sortBy, sortDir string, config *PaginationConfig) *PaginationRequest + type PaginationResponse struct + Data interface{} + Meta PaginationMeta + func CreatePaginationResponse(data interface{}, page, pageSize int, total int64) *PaginationResponse + type PaginationResponseWithLinks struct + Data interface{} + Links map[string]interface{} + Meta PaginationMeta + func CreatePaginationResponseWithLinks(data interface{}, page, pageSize int, total int64, baseURL string) *PaginationResponseWithLinks + type SortConfig struct + AllowedFields []string + DefaultDir string + DefaultField string + func CreateSortConfig(allowedFields []string, defaultField, defaultDir string) *SortConfig + func DefaultSortConfig() *SortConfig + type SortField struct + Direction string + Field string + func ParseSortRequest(sortStr string, config *SortConfig) ([]SortField, error)