listener

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler() http.Handler

Handler serves a wrapped mux

Types

type DB

type DB struct {
	DynamoDB dynamodbiface.DynamoDBAPI
}

DB wraps DynamodDB with iface pkg for easier testing

func (*DB) PutRec

func (d *DB) PutRec(r *Record) (*dynamodb.PutItemOutput, error)

PutRec puts an item in DynamoDB

func (*DB) UpdateRec

func (d *DB) UpdateRec(r *Record) (*dynamodb.UpdateItemOutput, error)

UpdateRec updates an item in DynamoDB

type Record

type Record struct {
	SupplierRef string `json:"supplierRef"`
	Status      string `json:"status"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Starts      string `json:"startTime"`
	Ends        string `json:"endTime"`
	Table       string
}

Record represents a change event

func (*Record) ParseHandler

func (r *Record) ParseHandler(w http.ResponseWriter, req *http.Request)

ParseHandler receives a payload from JSD

func (*Record) ParseRequest

func (r *Record) ParseRequest(input string) error

ParseRequest gets some values from inbound paylpad

func (*Record) ParseTime

func (r *Record) ParseTime(input string) error

ParseTime gets timestamps from inbound request and formats them for SNOW

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is a middleware handler that writes to db

func NewWriter

func NewWriter(handlerToWrap http.Handler) *Writer

NewWriter constructs a new middleware handler

func (*Writer) ServeHTTP

func (wr *Writer) ServeHTTP(rw http.ResponseWriter, req *http.Request)

serveHTTP passes the request from main handler to middleware

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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