Documentation
¶
Index ¶
- func GetPoints(c *fiber.Ctx) error
- func HandleError(e error, c *fiber.Ctx, status int) error
- func Home(c *fiber.Ctx) error
- func InitValidators()
- func ParseFloat(s any) float64
- func ProcessReceipt(c *fiber.Ctx) error
- func ValidateInput(data interface{}) *fiber.Error
- func ValidatePurchaseDate(fl validator.FieldLevel) bool
- func ValidatePurchaseTime(fl validator.FieldLevel) bool
- type Error
- type ErrorResponse
- type Item
- type ItemRaw
- type Receipt
- type ReceiptID
- type ReceiptPoints
- type ReceiptRaw
- type XValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleError ¶
func InitValidators ¶
func InitValidators()
func ParseFloat ¶
func ProcessReceipt ¶
func ProcessReceipt(c *fiber.Ctx) error
func ValidateInput ¶
func ValidateInput(data interface{}) *fiber.Error
func ValidatePurchaseDate ¶
func ValidatePurchaseDate(fl validator.FieldLevel) bool
func ValidatePurchaseTime ¶
func ValidatePurchaseTime(fl validator.FieldLevel) bool
Types ¶
type ErrorResponse ¶
type Receipt ¶
type Receipt struct { Retailer string PurchaseDate string PurchaseTime string Total float64 Items []Item Points int }
Used after validation
type ReceiptPoints ¶
type ReceiptPoints struct {
Points int `json:"points"`
}
type ReceiptRaw ¶
type ReceiptRaw struct { Retailer string `json:"retailer" validate:"required"` PurchaseDate string `json:"purchaseDate" validate:"required,purchaseDate"` PurchaseTime string `json:"purchaseTime" validate:"required,purchaseTime"` Total any `json:"total" validate:"required,numeric"` Items []ItemRaw `json:"items" validate:"required,min=1"` }
type XValidator ¶
type XValidator struct {
// contains filtered or unexported fields
}
func (XValidator) Validate ¶
func (v XValidator) Validate(data interface{}) []ErrorResponse
Click to show internal directories.
Click to hide internal directories.