Versions in this module Expand all Collapse all v0 v0.0.22 Dec 15, 2025 v0.0.21 Nov 29, 2025 Changes in this version + const StatusError + const StatusSuccess + func ApiData(c *gin.Context, code int, data interface{}, message string) + func BadRequest(c *gin.Context, code int, data interface{}, message string) + func BadRequestError(c *gin.Context, message string) + func BadRequestWithDetails(c *gin.Context, data interface{}, message string) + func Base64Decrypt(encryptedPassword string) (string, error) + func Base64DecryptWithMagic(encryptedPassword string) (string, error) + func Base64Encrypt(password string) string + func Base64EncryptWithMagic(password string) string + func DecryptBatch(encryptedSecretKeys []string, encryptionKey []byte) ([]string, error) + func DecryptSecretKey(encryptedSecretKey string, encryptionKey []byte) (string, error) + func DeleteWithId(l *zap.Logger, funcName string, timeout int, url string, ...) ([]byte, error) + func EncryptBatch(secretKeys []string, encryptionKey []byte) ([]string, error) + func EncryptSecretKey(secretKey string, encryptionKey []byte) (string, error) + func Error(c *gin.Context) + func ErrorWithDetails(c *gin.Context, data interface{}, message string) + func ErrorWithMessage(c *gin.Context, message string) + func Forbidden(c *gin.Context, data interface{}, message string) + func ForbiddenError(c *gin.Context, message string) + func GenerateKeyFromPassword(password string, salt []byte) ([]byte, error) + func GenerateRandomKey() ([]byte, error) + func GenerateRandomSalt() ([]byte, error) + func GetAge(creationTime time.Time) string + func GetClientIP(r *http.Request) string + func GetCustomParamID(ctx *gin.Context, paramID string) (int, error) + func GetLocalIPs() ([]string, error) + func GetParamCustomName(ctx *gin.Context, paramName string) (string, error) + func GetParamID(ctx *gin.Context) (int, error) + func GetQueryParam[T any](ctx *gin.Context, key string) (T, error) + func GetStringParam(ctx *gin.Context, key string) (string, error) + func HandleRequest(ctx *gin.Context, req interface{}, action func() (interface{}, error)) + func InternalServerError(c *gin.Context, code int, data interface{}, message string) + func InternalServerErrorWithDetails(c *gin.Context, data interface{}, message string) + func MapToStringSlice(inputMap map[string]string) ([]string, error) + func NewBusinessError(code error, message string) error + func Ping(ipAddr string) bool + func PostWithJsonString(l *zap.Logger, funcName string, timeout int, url string, jsonStr string, ...) ([]byte, error) + func SecureZeroMemory(data []byte) + func SetUserInfoToContext(ctx context.Context, userInfo *UserInfo) context.Context + func SetUserInfoToGinContext(c *gin.Context, userInfo *UserInfo) + func StringSliceToMap(inputSlice []string) (map[string]string, error) + func Success(c *gin.Context) + func SuccessWithData(c *gin.Context, data interface{}) + func SuccessWithDetails(c *gin.Context, data interface{}, message string) + func SuccessWithMessage(c *gin.Context, message string) + func Unauthorized(c *gin.Context, code int, data interface{}, message string) + func UnauthorizedErrorWithDetails(c *gin.Context, data interface{}, message string) + func ValidateEncryptedData(encryptedData string) error + func ValidateUniqueResource[T any](ctx context.Context, ...) error + type ApiResponse struct + Code int + Data interface{} + Message string + type BusinessError struct + Code error + Message string + func (e *BusinessError) Error() string + type UserInfo struct + IP string + UserAgent string + UserID int + Username string + func GetUserInfoFromContext(ctx context.Context) *UserInfo + func GetUserInfoFromGinContext(c *gin.Context) *UserInfo + func GetUserInfoFromHTTPRequest(r *http.Request) *UserInfo + func (u *UserInfo) Clone() *UserInfo + func (u *UserInfo) IsEmpty() bool + func (u *UserInfo) IsValid() bool + func (u *UserInfo) String() string