Documentation ¶
Index ¶
- Variables
- func BoolAddr(b bool) *bool
- func CheckPasswordHash(password, hash string) bool
- func ConvertStructData(object interface{}, targetStruct interface{}) interface{}
- func DateValidator(fl validator.FieldLevel) bool
- func DistinctField(fl validator.FieldLevel) bool
- func FileTypeValidator(fl validator.FieldLevel) bool
- func GenerateFileUrl(key string, folder string, contentType string) string
- func GetRandomInt(size int) uint32
- func GetRandomString(length int) string
- func HashPassword(password string) string
- func KeysExistInMap(keys []string, myMap map[string]interface{}) bool
- func ReactionTypeValidator(fl validator.FieldLevel) bool
- func UploadImage(file *os.File, key string, folder string)
- func ValidateUUID(fl validator.FieldLevel) bool
- type CustomValidator
- type ErrorResponse
- type SignatureFormat
Constants ¶
This section is empty.
Variables ¶
View Source
var ERR_EXPIRED_OTP = "expired_otp"
View Source
var ERR_INCORRECT_EMAIL = "incorrect_email"
View Source
var ERR_INCORRECT_OTP = "incorrect_otp"
View Source
var ERR_INVALID_AUTH = "invalid_auth"
View Source
var ERR_INVALID_CREDENTIALS = "invalid_credentials"
View Source
var ERR_INVALID_DATA_TYPE = "invalid_data_type"
View Source
var ERR_INVALID_ENTRY = "invalid_entry"
View Source
var ERR_INVALID_OWNER = "invalid_owner"
View Source
var ERR_INVALID_PAGE = "invalid_page"
View Source
var ERR_INVALID_REQUEST = "invalid_request"
View Source
var ERR_INVALID_TOKEN = "invalid_token"
View Source
var ERR_INVALID_VALUE = "invalid_value"
View Source
var ERR_NETWORK_FAILURE = "network_failure"
View Source
var ERR_NON_EXISTENT = "non_existent"
View Source
var ERR_NOT_ALLOWED = "not_allowed"
View Source
var ERR_SERVER_ERROR = "server_error"
View Source
var ERR_UNAUTHORIZED_USER = "unauthorized_user"
Error codes
View Source
var ERR_UNVERIFIED_USER = "unverified_user"
View Source
var ImageExtensions = map[string]string{
"image/jpeg": "jpg",
"image/png": "png",
"image/gif": "gif",
"image/bmp": "bmp",
"image/webp": "webp",
"image/tiff": "tiff",
"image/svg+xml": "svg",
}
Functions ¶
func CheckPasswordHash ¶
func ConvertStructData ¶
func ConvertStructData(object interface{}, targetStruct interface{}) interface{}
func DateValidator ¶
func DateValidator(fl validator.FieldLevel) bool
Validates if a date has a correct format (ISO8601)
func DistinctField ¶
func DistinctField(fl validator.FieldLevel) bool
func FileTypeValidator ¶
func FileTypeValidator(fl validator.FieldLevel) bool
Validates if a file type is accepted
func GetRandomInt ¶
Generates a random integer with a specified number of digits
func GetRandomString ¶
func KeysExistInMap ¶
Check if keys exist in map
func ReactionTypeValidator ¶
func ReactionTypeValidator(fl validator.FieldLevel) bool
Validates if a reaction value is the correct one
func ValidateUUID ¶
func ValidateUUID(fl validator.FieldLevel) bool
Types ¶
type CustomValidator ¶
type CustomValidator struct{}
CustomValidator is a custom validator that uses "github.com/go-playground/validator/v10"
func (*CustomValidator) Validate ¶
func (cv *CustomValidator) Validate(i interface{}) *ErrorResponse
Validate performs the validation of the given struct
type ErrorResponse ¶
type ErrorResponse struct { Status string `json:"status"` Code string `json:"code"` Message string `json:"message"` Data *map[string]string `json:"data,omitempty"` }
func RequestErr ¶
func RequestErr(code string, message string, opts ...map[string]string) ErrorResponse
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
func (ErrorResponse) Init ¶
func (obj ErrorResponse) Init() ErrorResponse
type SignatureFormat ¶
type SignatureFormat struct { PublicId string `json:"public_id" example:"images/f47ac10b-58cc-4372-a567-0e02b2c3d479"` Signature string `json:"signature" example:"e1ba4683fbbf90b75ca22e9f8e545b18c6b24eae"` Timestamp int64 `json:"timestamp" example:"1678828200"` }
func GenerateFileSignature ¶
func GenerateFileSignature(key string, folder string) SignatureFormat
Click to show internal directories.
Click to hide internal directories.