models

package
v0.0.0-...-0549c05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Email represents the notification type of email
	Email = "email"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Line1      string `json:"line1" validate:"required"`
	Line2      string `json:"line2,omitempty"`
	City       string `json:"city" validate:"required"`
	State      string `json:"state" validate:"required"`
	PostalCode string `json:"postalCode" validate:"required"`
}

Address represents an customers address

type Customer

type Customer struct {
	FirstName       string  `json:"firstName" validate:"required"`
	LastName        string  `json:"lastName" validate:"required"`
	EmailAddress    string  `json:"emailAddress" validate:"required"`
	ShippingAddress Address `json:"shippingAddress" validate:"required,dive"`
}

Customer represents information about the customer placing the order

type Error

type Error struct {
	Message   string
	Timestamp time.Time
}

Error represents an error that has occurred in the system

func NewError

func NewError(err error) Error

NewError will create a new Error object from a base error

type Health

type Health struct {
	Status string `json:"status"`
}

Health struct to describe health object.

type Notification

type Notification struct {
	Type      NotificationType `json:"type"`
	Recipient string           `json:"recipient"`
	From      string           `json:"from"`
	Subject   string           `json:"subject"`
	Body      string           `json:"body"`
}

Notification represent a notification to be sent

type NotificationType

type NotificationType string

NotificationType the supported types of notifications

func (NotificationType) IsValid

func (nt NotificationType) IsValid() error

IsValid returns true if the notification type is valid

func (*NotificationType) UnmarshalJSON

func (nt *NotificationType) UnmarshalJSON(b []byte) error

UnmarshalJSON will unmarshall the notification type

type Order

type Order struct {
	ID       uuid.UUID `json:"id,omitempty" validate:"required,uuid"`
	Products []Product `json:"products" validate:"required,dive"`
	Customer Customer  `json:"customer" validate:"required,dive"`
}

Order represents a collection of products that should be shipped to the specified shipping address

type Product

type Product struct {
	ProductCode string `json:"productCode" validate:"required"`
	Quantity    int    `json:"quantity" validate:"required"`
}

Product represents a single product in an order

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL