Documentation
¶
Index ¶
- func APIResponse(c *gin.Context, status int, message string, data interface{})
- func CheckPasswordHash(password, hash string) bool
- func CompareHashAndPassword(hashedPassword, password string) error
- func ErrorResponse(c *gin.Context, status int, message string)
- func GenerateSecureToken() (string, error)
- func HasMaxLength(fieldName, value string, maxLength int) error
- func HasMinLength(fieldName, value string, minLength int) error
- func HashPassword(password string) (string, error)
- func IsHashedPassword(str string) bool
- func IsValidEmail(email string) bool
- func NotFoundResponse(c *gin.Context, message string)
- func StringToUUID(id string) (uuid.UUID, error)
- func ValidateEmail(email string) error
- func ValidateNotEmpty(fieldName, value string) error
- func ValidatePassword(password string) error
- func ValidateURL(rawURL string) error
- func ValidateUUID(id string) error
- func ValidateUsername(username string) error
- func ValidationErrorResponse(c *gin.Context, message string, errors interface{})
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIResponse ¶
APIResponse returns a success response with data
func CheckPasswordHash ¶
CheckPasswordHash membandingkan password dengan hash
func CompareHashAndPassword ¶
CompareHashAndPassword is a wrapper around bcrypt's CompareHashAndPassword that returns a more user-friendly error message
func ErrorResponse ¶
ErrorResponse returns an error response
func GenerateSecureToken ¶
GenerateSecureToken generates a cryptographically secure token for various purposes (like password reset, email verification, etc.)
func HasMaxLength ¶
HasMaxLength validates if a string doesn't exceed the maximum length
func HasMinLength ¶
HasMinLength validates if a string meets the minimum length
func HashPassword ¶
HashPassword mengenkripsi password dengan bcrypt
func IsHashedPassword ¶
IsHashedPassword checks if a string is already a bcrypt hash
func IsValidEmail ¶
IsValidEmail checks if the email has a valid format (returns boolean)
func NotFoundResponse ¶
NotFoundResponse returns a standardized not found response
func StringToUUID ¶
StringToUUID converts a string to UUID and validates it
func ValidateEmail ¶
ValidateEmail memastikan format email valid
func ValidateNotEmpty ¶
ValidateNotEmpty validates if a string is not empty
func ValidatePassword ¶
ValidatePassword validates a password with stricter rules
func ValidateURL ¶
ValidateURL validates if a string is a valid URL
func ValidateUUID ¶
ValidateUUID validates if a string is a valid UUID
func ValidateUsername ¶
ValidateUsername validates a username
func ValidationErrorResponse ¶
ValidationErrorResponse returns a standardized validation error response