Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Schema = &memdb.DBSchema{ Tables: map[string]*memdb.TableSchema{ "product": &memdb.TableSchema{ Name: "product", Indexes: map[string]*memdb.IndexSchema{ "id": &memdb.IndexSchema{ Name: "id", Unique: true, Indexer: &memdb.StringFieldIndex{Field: "SKU"}, }, }, }, }, }
Schema is the schema for the write model
Functions ¶
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler represents the write http handler
func NewHandler ¶
func NewHandler(db *memdb.MemDB, natsClient *nats.Conn) *Handler
NewHandler creates a new write Handler
func (*Handler) InsertProduct ¶
func (h *Handler) InsertProduct(w http.ResponseWriter, r *http.Request)
InsertProduct writes a new product to event store and publishes the event
func (*Handler) StockCount ¶
func (h *Handler) StockCount(rw http.ResponseWriter, r *http.Request)
StockCount returns the stock count for a product
Click to show internal directories.
Click to hide internal directories.