write

package
v0.0.0-...-cde7464 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2019 License: MIT Imports: 7 Imported by: 0

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

func SeedDB

func SeedDB(db *memdb.MemDB)

SeedDB seeds the db with data

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

Jump to

Keyboard shortcuts

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