schema

package
v0.0.0-...-3d84a2e Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT-0 Imports: 5 Imported by: 1

Documentation

Overview

Package schema defines order document structures as they might be stored in a Google Firestore or represented in JSON

Index

Constants

View Source
const (
	// OrderCollection names the firestore collection under which all of our documents are stored
	OrderCollection = "orders"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Order

type Order struct {

	// Id is a UUID ID in hexadecimal string form - a unique ID for this order.
	// This will be set by the cart when the order is submitted.
	Id string `firestore:"id" json:"id"`

	// SubmissionTime is the time at which cart checkout was completed and the order was submitted for payment
	SubmissionTime time.Time `firestore:"submissionTime" json:"submissionTime"`

	// OrderedBy identifies the person who submitted the order
	OrderedBy *types.Person `firestore:"orderedBy" json:"orderedBy"`

	// DeliveryAddress is the delivery address for the order
	DeliveryAddress *types.PostalAddress `firestore:"deliveryAddress,omitempty" json:"deliveryAddress,omitempty"`

	// OrderItems is the list of one to many items that make up the potential order
	OrderItems []*OrderItem `firestore:"orderItems" json:"orderItems"`
}

Order represents the permanent record of what a customer has purchased. An order is derived from a shopping cart upon checkout.

func (*Order) AsPBOrder

func (o *Order) AsPBOrder() *pborder.Order

AsPBOrder returns the protocol buffer representation of this order.

func (*Order) StoreRefPath

func (o *Order) StoreRefPath() string

StoreRefPath returns the string representation of the document reference path for this Order.

type OrderItem

type OrderItem struct {

	// Id is a UUID ID in hexadecimal string form - a unique ID for this order item.
	Id string `firestore:"id" json:"id"`

	// ProductCode is the equivalent of a SKU code identifying the type of
	// product or service ordered.
	ProductCode string `firestore:"productCode" json:"productCode"`

	// Quantity is the number of this item type that was ordered.
	Quantity int32 `firestore:"quantity" json:"quantity"`

	// UnitPrice is the price that the customer was shown for a single item
	// when they selected the item for their cart.
	UnitPrice *types.Money `firestore:"unitPrice" json:"unitPrice"`
}

OrderItem represents a single entry in an order. An order will contain one to many order items.

func (*OrderItem) AsPBOrderItem

func (item *OrderItem) AsPBOrderItem() *pborder.OrderItem

AsPBOrderItem returns the protocol buffer representation of this cart item.

Jump to

Keyboard shortcuts

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