Documentation
¶
Index ¶
- func ConvertEpochToTime(epochTime int64) string
- func Decrypt(data string, key []byte, iv []byte) (string, error)
- func Encrypt(data []byte, key []byte, iv []byte) (string, error)
- func GenerateOrderID() string
- func GenerateQRCode(encryptedData string) ([]byte, error)
- func GenerateQRCodeWithEncryptedData(qrCodeDetails QRCodeDetails, key, iv []byte, smallImage []byte) ([]byte, error)
- func GenerateRandomInt(n int) int
- func GenerateRandomString(n int) string
- func Paginate(p *Pagination) func(db *gorm.DB) *gorm.DB
- type ApiError
- type AuthClaims
- type HTTPError
- func BadRequestError(fmtString string, args ...interface{}) *HTTPError
- func ConflictError(fmtString string, args ...interface{}) *HTTPError
- func CreatedOK(fmtString string, args ...interface{}) *HTTPError
- func ExpiredTokenError(fmtString string, args ...interface{}) *HTTPError
- func ForbiddenError(fmtString string, args ...interface{}) *HTTPError
- func InternalServerError(fmtString string, args ...interface{}) *HTTPError
- func NoContent(fmtString string, args ...interface{}) *HTTPError
- func NotFoundError(fmtString string, args ...interface{}) *HTTPError
- func NotImplemented(fmtString string, args ...interface{}) *HTTPError
- func OK(fmtString string, args ...interface{}) *HTTPError
- func PrettyORMErr(err error) *HTTPError
- func TooManyRequestsError(fmtString string, args ...interface{}) *HTTPError
- func UnauthorizedError(fmtString string, args ...interface{}) *HTTPError
- func UnprocessableEntityError(fmtString string, args ...interface{}) *HTTPError
- type IDQueryString
- type Pagination
- type QRCodeDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertEpochToTime ¶
func GenerateOrderID ¶
func GenerateOrderID() string
generate a random numbers with a prefix of "KC-" and a length of 8
func GenerateQRCode ¶
func GenerateQRCodeWithEncryptedData ¶
func GenerateQRCodeWithEncryptedData(qrCodeDetails QRCodeDetails, key, iv []byte, smallImage []byte) ([]byte, error)
func GenerateRandomString ¶
generate a random string with a length of n
Types ¶
type AuthClaims ¶
type AuthClaims struct { UserID uuid.UUID BusinessID uuid.UUID RoleID uuid.UUID FirstName string LastName string Email string Phone string }
func GetAuthClaims ¶
func GetAuthClaims(ctx *gin.Context) *AuthClaims
type HTTPError ¶
type HTTPError struct { Code int `json:"code"` Message string `json:"message,omitempty"` Messages []ApiError `json:"messages,omitempty"` InternalError error `json:"-"` InternalMessage string `json:"-"` ErrorID string `json:"error_id,omitempty"` }
func BadRequestError ¶
func ConflictError ¶
func ExpiredTokenError ¶
func ForbiddenError ¶
func InternalServerError ¶
func NotFoundError ¶
func NotImplemented ¶
func PrettyORMErr ¶
func TooManyRequestsError ¶
func UnauthorizedError ¶
func (*HTTPError) WithInternalError ¶
WithInternalError adds internal error information to the error
func (*HTTPError) WithInternalMessage ¶
WithInternalMessage adds internal message information to the error
type IDQueryString ¶
type IDQueryString struct {
ID string `uri:"id" binding:"required,uuid"`
}
type Pagination ¶
type QRCodeDetails ¶
type QRCodeDetails struct { UserID string ProductID string TransactionID string TransactionType string UserName string UserEmail string UserZipCode string IsUserEarlyAccess bool ProductName string Description string Package string BasePrice string PriceWithDiscount string DiscountInPercentage string Date string }
Click to show internal directories.
Click to hide internal directories.