Documentation
¶
Index ¶
- func Capitalize(s string) string
- func Contains(slice any, item any) bool
- func ErrToString(err error) string
- func FiberLoggerOutput(str string) io.Writer
- func FormatDuration(d time.Duration) string
- func FromJSON(jsonStr string, v any) error
- func GenerateID() (string, error)
- func GenerateUUID() (string, error)
- func GetClientIP(r *http.Request) string
- func HashPassword(password string) string
- func IsValidUUID(uuid string) bool
- func JSONMarshal(v interface{}) ([]byte, error)
- func JSONMarshalIndent(v interface{}, prefix, indent string) ([]byte, error)
- func JSONMarshalNoEscape(v interface{}) ([]byte, error)
- func JSONUnmarshal(data []byte, v interface{}) error
- func MapToStruct(data map[string]any, result any) error
- func NewPaginatedResponse(data any, pagination Pagination) out.Response
- func RemoveDuplicates(slice any) any
- func Retry(fn func() error, maxRetries int, initialDelay time.Duration) error
- func SanitizeString(input string) string
- func StringPtr(s string) *string
- func StructToMap(obj any) (map[string]any, error)
- func ToCamelCase(s string) string
- func ToIndentJSON(v any) (string, error)
- func ToJSON(v any) (string, error)
- func ToLogJSON(v any) string
- func ToSnakeCase(s string) string
- func Truncate(s string, length int) string
- func ValidateEmail(email string) bool
- func ValidatePhone(phone string) bool
- type Filter
- type Pagination
- type Sort
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capitalize ¶
Capitalize capitalizes the first letter of a string
func ErrToString ¶
errToString converts an error to a string, returning "nil" if error is nil
func FiberLoggerOutput ¶
func FormatDuration ¶
FormatDuration formats a duration as a human-readable string
func GetClientIP ¶
GetClientIP gets the client IP address from a request
func HashPassword ¶
HashPassword hashes a password (placeholder - implement actual hashing)
func IsValidUUID ¶
IsValidUUID checks if a string is a valid UUID
func JSONMarshal ¶
func JSONMarshalIndent ¶
func JSONMarshalNoEscape ¶
func JSONUnmarshal ¶
func MapToStruct ¶
MapToStruct converts a map to a struct
func NewPaginatedResponse ¶
func NewPaginatedResponse(data any, pagination Pagination) out.Response
NewPaginatedResponse creates a paginated response
func RemoveDuplicates ¶
RemoveDuplicates removes duplicate values from a slice
func SanitizeString ¶
SanitizeString sanitizes a string by removing potentially harmful characters
func StructToMap ¶
StructToMap converts a struct to a map
func ToIndentJSON ¶
Types ¶
type Filter ¶
type Filter struct {
Field string `json:"field" form:"field"`
Operator string `json:"operator" form:"operator"`
Value any `json:"value" form:"value"`
}
Filter represents query filter parameters