Documentation ¶
Index ¶
- Variables
- func AccountTypeValidator(fl validator.FieldLevel) bool
- func AgeDiscretionValidator(fl validator.FieldLevel) bool
- func ChapterStatusValidator(fl validator.FieldLevel) bool
- func CheckPasswordHash(password, hash string) bool
- func ContractIDTypeChoiceValidator(fl validator.FieldLevel) bool
- func ContractStatusChoiceValidator(fl validator.FieldLevel) bool
- func ContractTypeChoiceValidator(fl validator.FieldLevel) bool
- func ConvertStructData(object interface{}, targetStruct interface{}) interface{}
- func GetRandomInt(size int) int
- func GetRandomString(length int) string
- func HashPassword(password string) string
- func PaymentTypeValidator(fl validator.FieldLevel) bool
- func RatingChoiceValidator(fl validator.FieldLevel) bool
- func RegisterTagName()
- func SubscriptionTypeValidator(fl validator.FieldLevel) bool
- func Title(s string) string
- type CustomValidator
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
var ERR_ADMINS_ONLY = "admins_only"
var ERR_ALREADY_BOUGHT = "already_bought"
var ERR_ALREADY_REVIEWED = "already_reviewed"
var ERR_ALREADY_VOTED = "already_voted"
var ERR_AUTHORS_ONLY = "authors_only"
var ERR_CONTRACT_ALREADY_APPROVED = "contract_already_approved"
var ERR_EXPIRED_OTP = "expired_otp"
var ERR_EXPIRED_TOKEN = "expired_token"
var ERR_INCORRECT_EMAIL = "incorrect_email"
var ERR_INCORRECT_OTP = "incorrect_otp"
var ERR_INCORRECT_TOKEN = "incorrect_token"
var ERR_INSUFFICIENT_COINS = "insufficient_coins"
var ERR_INSUFFICIENT_LANTERNS = "insufficient_lanterns"
var ERR_INVALID_AUTH = "invalid_auth"
var ERR_INVALID_CREDENTIALS = "invalid_credentials"
var ERR_INVALID_DATA_TYPE = "invalid_data_type"
var ERR_INVALID_ENTRY = "invalid_entry"
var ERR_INVALID_OWNER = "invalid_owner"
var ERR_INVALID_PAGE = "invalid_page"
var ERR_INVALID_PARAM = "invalid_param"
var ERR_INVALID_PAYLOAD = "invalid_payload"
var ERR_INVALID_REQUEST = "invalid_request"
var ERR_INVALID_TOKEN = "invalid_token"
var ERR_INVALID_VALUE = "invalid_value"
var ERR_NETWORK_FAILURE = "network_failure"
var ERR_NON_EXISTENT = "non_existent"
var ERR_NOT_ALLOWED = "not_allowed"
var ERR_NOT_FOUND = "not_found"
var ERR_PASSWORD_MISMATCH = "password_does_not_match"
var ERR_PASSWORD_SAME = "same_password"
var ERR_SERVER_ERROR = "server_error"
var ERR_UNAUTHORIZED_USER = "unauthorized_user"
Error codes
var ERR_UNVERIFIED_USER = "unverified_user"
Functions ¶
func AccountTypeValidator ¶
func AccountTypeValidator(fl validator.FieldLevel) bool
Validates if a account type value is the correct one
func AgeDiscretionValidator ¶
func AgeDiscretionValidator(fl validator.FieldLevel) bool
Validates if a age discretion value is the correct one
func ChapterStatusValidator ¶
func ChapterStatusValidator(fl validator.FieldLevel) bool
Validates if a chapter status value is the correct one
func CheckPasswordHash ¶
func ContractIDTypeChoiceValidator ¶
func ContractIDTypeChoiceValidator(fl validator.FieldLevel) bool
Validates if a contract idtype choice value is the correct one
func ContractStatusChoiceValidator ¶
func ContractStatusChoiceValidator(fl validator.FieldLevel) bool
Validates if a contract status choice value is the correct one
func ContractTypeChoiceValidator ¶
func ContractTypeChoiceValidator(fl validator.FieldLevel) bool
Validates if a contract type choice value is the correct one
func ConvertStructData ¶
func ConvertStructData(object interface{}, targetStruct interface{}) interface{}
Converting struct type to another provided the field names are the same
func GetRandomInt ¶
Generates a random integer with a specified number of digits
func GetRandomString ¶
func HashPassword ¶
func PaymentTypeValidator ¶
func PaymentTypeValidator(fl validator.FieldLevel) bool
Validates if a payment type value is the correct one
func RatingChoiceValidator ¶
func RatingChoiceValidator(fl validator.FieldLevel) bool
Validates if a rating choice value is the correct one
func RegisterTagName ¶
func RegisterTagName()
func SubscriptionTypeValidator ¶
func SubscriptionTypeValidator(fl validator.FieldLevel) bool
Validates if a subscription type value is the correct one
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 NotFoundErr ¶
func NotFoundErr(message string) ErrorResponse
func RequestErr ¶
func RequestErr(code string, message string, opts ...map[string]string) ErrorResponse
func ValidationErr ¶
func ValidationErr(field string, message string) ErrorResponse
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string