kipapi

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2017 License: MIT Imports: 6 Imported by: 0

README

GoDoc

Kipapi is a CRUD HTTP API.

How to use

Create and expose CRUD via HTTP API

mydao := NewDaoUsers()  // Build DAO with Kip
myapi := golax.NewApi() // Create golax api
kipapi.New(myapi.Root, mydao) // Expose

Kipapi developer

Run tests

make setup && make test

Coverage

make setup && make coverage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetId

func GetId(c *golax.Context) *bson.ObjectId

func GetItem

func GetItem(c *golax.Context) *kip.Item

Types

type Context

type Context struct {
	Filter  bson.M
	Item    *kip.Item
	Printed map[string]interface{}
	Patches []*kip.Patch
	Patch   *kip.Patch
}

type Kipapi

type Kipapi struct {
	Dao            *kip.Dao
	ParentNode     *golax.Node
	CollectionNode *golax.Node
	ItemNode       *golax.Node

	HookCreate    func(c *golax.Context)
	HookDelete    func(id *bson.ObjectId, c *golax.Context)
	HookFilter    func(d *Context, c *golax.Context)
	HookInsert    func(d *Context, c *golax.Context)
	HookList      func(c *golax.Context)
	HookListItem  func(d *kip.Item, c *golax.Context) *kip.Item
	HookPrint     func(d *Context, c *golax.Context)
	HookPatch     func(d *Context, c *golax.Context)
	HookPatchItem func(d *Context, c *golax.Context)
	HookRetrieve  func(id *bson.ObjectId, c *golax.Context)
	HookUpdate    func(id *bson.ObjectId, c *golax.Context)
}

func New

func New(pn *golax.Node, d *kip.Dao) *Kipapi

func (*Kipapi) Map

func (k *Kipapi) Map(i *kip.Item, c *golax.Context) bson.M

func (*Kipapi) PrintItem

func (k *Kipapi) PrintItem(i *kip.Item, c *golax.Context)

Jump to

Keyboard shortcuts

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