subscription

package
v0.0.0-...-80abe43 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDB

func CreateDB(db *sql.DB) error

CreateDB will setup the subscriptions table if it does not yet exist

Types

type Database

type Database interface {
	// contains filtered or unexported methods
}

Database is an interface for retrieving Subscriptions

type Handler

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

func NewHandler

func NewHandler() *Handler

func (*Handler) Create

func (h *Handler) Create(w http.ResponseWriter, r *http.Request, p httprouter.Params)

Create is a REST API for creating a new subscription, based on the JSON payload

func (*Handler) Destroy

func (h *Handler) Destroy(w http.ResponseWriter, r *http.Request, p httprouter.Params)

Destroy is a REST API for destroying an subscription, based on the subscription id

func (*Handler) Index

Index is a REST API for listing all registered subscriptions

func (*Handler) Show

Show is a REST API for listing a single subscription, found by id

type PgDatabase

type PgDatabase struct{}

PgDatabase is a structure that implements the Database interface and interacts with Postgres db

type Subscription

type Subscription struct {
	ID        uuid.UUID `json:"id"`
	EventType string    `json:"event_type"`
	Context   string    `json:"context"`
	AccountID uuid.UUID `json:"account_id"`
	CreatedAt time.Time `json:"timestamp"`
}

Subscription is a structure that matches the json content for REST calls

Jump to

Keyboard shortcuts

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