api

package
v0.0.0-...-d98f53d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Post *PostResource
}

func NewAPI

func NewAPI(db *mongo.Database) *API

type PostResource

type PostResource struct {
	Store PostStore
}

func NewPostResource

func NewPostResource(store PostStore) *PostResource

func (*PostResource) Create

func (*PostResource) Delete

func (*PostResource) Get

func (*PostResource) ListAll

func (rs *PostResource) ListAll(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

type PostStore

type PostStore interface {
	Create(*database.Post) (*mongo.InsertOneResult, error)
	Get(primitive.ObjectID) (*database.Post, error)
	Delete(primitive.ObjectID) (*mongo.DeleteResult, error)
	ListAll() (*[]database.Post, error)
}

Jump to

Keyboard shortcuts

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