Documentation
¶
Index ¶
- type Coupon
- type Customer
- type Downloadable
- type DownloadableDeleter
- type DownloadableReader
- type DownloadableRepository
- type DownloadableWriter
- type IDGenerator
- type Order
- type Payment
- type Product
- type ProductReader
- type ProductRepository
- type ProductType
- type ProductUpdater
- type ProductWriter
- type Storage
- type StorageDeleter
- type StorageReader
- type StorageWriter
- type TimeService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coupon ¶
type Coupon struct { ID string `firestore:"-"` Description string `firestore:"description"` Active bool `firestore:"active"` AmountOff int64 `firestore:"amountOff"` PercentOff float64 `firestore:"percentOff"` MaxRedemptions int64 `firestore:"maxRedemptions"` RedeemBy int64 `firestore:"redeemBy"` RedeemBefore int64 `firestore:"redeemBefore"` }
Coupon is the domain and data model representing a Coupon in miniCommerce
type Customer ¶
type Customer struct { Name string `firestore:"name"` Email string `firestore:"email"` Address string `firestore:"address"` ZipCode string `firestore:"zipCode"` Phone string `firestore:"phone"` }
Customer is...
type Downloadable ¶
type Downloadable struct { ID string `firestore:"-" json:"id"` Name string `firestore:"name" json:"name"` Location string `firestore:"location" json:"location"` }
Downloadable is the location of a downloadable digital product uploaded somewhere to google cloud storage
type DownloadableDeleter ¶
DownloadableDeleter ...
type DownloadableReader ¶
type DownloadableReader interface { Get(ctx context.Context, id string) (*Downloadable, error) GetAll(ctx context.Context) ([]Downloadable, error) }
DownloadableReader ...
type DownloadableRepository ¶
type DownloadableRepository interface { DownloadableReader DownloadableWriter DownloadableDeleter }
DownloadableRepository ...
type DownloadableWriter ¶
type DownloadableWriter interface {
Create(ctx context.Context, downloadable *Downloadable) error
}
DownloadableWriter ..
type IDGenerator ¶
IDGenerator is the abstraction for generating ID's in minicommerce
type Order ¶
type Order struct { ID string `firestore:"-"` PaymentID string `firestore:"paymentId"` Coupon string `firestore:"coupon"` Items []Product `firestore:"items"` Customer Customer `firestore:"customer"` Refunded bool `firestore:"refunded"` Amount int64 `firestore:"amount"` Discount int64 `firestore:"discount"` Shipping int64 `firestore:"shipping"` NetAmount int64 `firestore:"netAmount"` Taxes int64 `firestore:"taxes"` Total int64 `firestore:"total"` }
Order represents the domain model for an order or cart in minicommerce
type Payment ¶
type Payment struct { ID string `firestore:"-"` ExternalID string `firestore:"externalID,omitempty"` Amount int64 `firestore:"amount,omitempty"` Paid bool `firestore:"paid,omitempty"` Refunded bool `firestore:"refunded,omitempty"` }
Payment represents the domain model for payments within the system
type Product ¶
type Product struct { ID string `firestore:"-" json:"id"` Created int64 `firestore:"created" json:"created"` Updated int64 `firestore:"updated" json:"updated"` Type ProductType `firestore:"type" json:"type"` Name string `firestore:"name" json:"name"` Description string `firestore:"description" json:"description"` Price int64 `firestore:"price" json:"price"` Metadata map[string]string `firestore:"metadata" json:"metadata"` Active bool `firestore:"active" json:"active"` URL string `firestore:"url" json:"url"` Downloadable []Downloadable `firestore:"downloadable" json:"downloadables"` }
Product represents the domain and data model for miniCommerce
type ProductReader ¶
type ProductReader interface { GetAll(ctx context.Context) ([]Product, error) Get(ctx context.Context, id string) (*Product, error) }
ProductReader is the interface for reading products from a given datastore
type ProductRepository ¶
type ProductRepository interface { ProductReader ProductWriter ProductUpdater }
ProductRepository is the interface that combines all readers and writers for a product
type ProductType ¶
type ProductType string
ProductType is the representation of the product type within miniCommerce
const ( ProductTypeDigital ProductType = "digital" ProductTypeLink ProductType = "linkable" ProductTypeShippable ProductType = "shippable" )
List of Product types available for a product
type ProductUpdater ¶
ProductUpdater is the interface for updating a product in a given datastor
type ProductWriter ¶
ProductWriter is the interface for creating a product in a given datastore
type Storage ¶
type Storage interface { StorageWriter StorageReader StorageDeleter }
Storage is the engine that can read,write,delete storage objects
type StorageDeleter ¶
StorageDeleter ..
type StorageReader ¶
StorageReader ...
type StorageWriter ¶
StorageWriter ..
type TimeService ¶
type TimeService interface {
Now() int64
}
TimeService is an abstraction on top of time pkg for easier testability whenever time is used in the minicommerce