db

package
v0.0.0-...-97cf3a7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(w http.ResponseWriter, r *http.Request)

Create a person object example: curl -d '{"id":"100", "firstname":"foo", "lastname":"bar"}' -H "Content-Type: application/json" -X POST http://backend:8000/db/100

func Delete

func Delete(w http.ResponseWriter, r *http.Request)

Delete a person object example: curl -X DELETE http://backend:8000/db/100

func Get

func Get(w http.ResponseWriter, r *http.Request)

Get a person object

func GetAll

func GetAll(w http.ResponseWriter, r *http.Request)

GetAll person objects

func Init

func Init(session *mgo.Session)

Init ...

func Update

func Update(w http.ResponseWriter, r *http.Request)

Update a person object example: curl -d '{"lastname":"brad"}' -X PUT http://backend:8000/db/100

Types

type Address

type Address struct {
	City  string `json:"city,omitempty" bson:"city"`
	State string `json:"state,omitempty" bson:"state"`
}

Address type

type Person

type Person struct {
	ID        string   `json:"id,omitempty" bson:"id"`
	Firstname string   `json:"firstname,omitempty" bson:"firstname"`
	Lastname  string   `json:"lastname,omitempty" bson:"lastname"`
	Address   *Address `json:"address,omitempty" bson:"address"`
}

Person type

Jump to

Keyboard shortcuts

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