Documentation ¶
Index ¶
- Variables
- func CheckPasswordHash(password, hash string) bool
- func ConvertStructData(object interface{}, targetStruct interface{}) interface{}
- func DateValidator(fl validator.FieldLevel) bool
- func DeleteFile(fileKey string) error
- func FilteredFields(body map[string]interface{}, allowedFields ...string) map[string]interface{}
- func GenerateRandomToken(length int, uppercase bool) (string, error)
- func GetFile(fileKey string) ([]byte, error)
- func GetRandomInt(size int) int64
- func GetRandomString(length int) string
- func GetStripeAllowedCountries() *stripe.CheckoutSessionShippingAddressCollectionParams
- func GetStripeShippingOptions() []*stripe.CheckoutSessionShippingOptionParams
- func HashPassword(password string) string
- func UploadFile(file *multipart.FileHeader) (string, error)
- func ValidateDiscountedPrice(fl validator.FieldLevel) bool
- func ValidateUUID(fl validator.FieldLevel) bool
- type CustomValidator
- type ErrorResponse
- type S3Client
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SuccessURL = stripe.String(successURL) CancelURL = stripe.String(cancelURL) )
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_OAUTH = "oauth_error"
View Source
var ERR_REQUEST_LIMIT = "request_limit_hit"
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"
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 DeleteFile ¶
DeleteFile deletes a file from the S3 bucket
func FilteredFields ¶
FilteredFields filters the fields that are allowed to be updated.
func GenerateRandomToken ¶
GenerateRandomToken generates a random token of specified length and case (upper or lower).
func GetRandomInt ¶
Generates a random integer with a specified number of digits
func GetRandomString ¶
func GetStripeAllowedCountries ¶
func GetStripeAllowedCountries() *stripe.CheckoutSessionShippingAddressCollectionParams
func GetStripeShippingOptions ¶
func GetStripeShippingOptions() []*stripe.CheckoutSessionShippingOptionParams
func UploadFile ¶
func UploadFile(file *multipart.FileHeader) (string, error)
UploadFile uploads a file to S3 and returns the URL of the uploaded file
func ValidateDiscountedPrice ¶
func ValidateDiscountedPrice(fl validator.FieldLevel) bool
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
Click to show internal directories.
Click to hide internal directories.