store

package
v0.0.0-...-0e6c039 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2016 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package store is a collection of composable interfaces that are can be implemented in order to build a storage driver

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action func(ctx context.Context, w http.ResponseWriter, r *http.Request) (*jsh.Object, jsh.ErrorType)

Action is a handler that performs a specific action on a resource.

type CRUD

type CRUD interface {
	Save(ctx context.Context, object *jsh.Object) (*jsh.Object, jsh.ErrorType)
	Get(ctx context.Context, id string) (*jsh.Object, jsh.ErrorType)
	List(ctx context.Context) (jsh.List, jsh.ErrorType)
	Update(ctx context.Context, object *jsh.Object) (*jsh.Object, jsh.ErrorType)
	Delete(ctx context.Context, id string) jsh.ErrorType
}

CRUD is a resource controller interface.

type Delete

type Delete func(ctx context.Context, id string) jsh.ErrorType

Delete an object from storage by id.

type Get

type Get func(ctx context.Context, id string) (*jsh.Object, jsh.ErrorType)

Get a specific instance of a resource by id from storage.

type List

type List func(ctx context.Context) (jsh.List, jsh.ErrorType)

List all instances of a resource from storage.

type Save

type Save func(ctx context.Context, object *jsh.Object) (*jsh.Object, jsh.ErrorType)

Save a new resource to storage.

type ToMany

type ToMany interface {
	ListResources(ctx context.Context, id string) (jsh.List, jsh.ErrorType)
	List(ctx context.Context, id string) (jsh.IDList, jsh.ErrorType)
	Save(ctx context.Context, id string, list jsh.IDList) (jsh.IDList, jsh.ErrorType)
	Update(ctx context.Context, id string, list jsh.IDList) (jsh.IDList, jsh.ErrorType)
	Delete(ctx context.Context, id string, list jsh.IDList) (jsh.IDList, jsh.ErrorType)
}

ToMany is a to-many resource relationship controller interface.

type ToManyList

type ToManyList func(ctx context.Context, id string) (jsh.IDList, jsh.ErrorType)

List all relationships of a resource from storage.

type ToManyListResources

type ToManyListResources func(ctx context.Context, id string) (jsh.List, jsh.ErrorType)

List all resources related to a resource from storage.

type ToManyUpdate

type ToManyUpdate func(ctx context.Context, id string, list jsh.IDList) (jsh.IDList, jsh.ErrorType)

Update existing relationships in storage.

type ToOne

type ToOne interface {
	GetResource(ctx context.Context, id string) (*jsh.Object, jsh.ErrorType)
	Get(ctx context.Context, id string) (*jsh.IDObject, jsh.ErrorType)
	Update(ctx context.Context, id string, relationship *jsh.IDObject) (*jsh.IDObject, jsh.ErrorType)
}

ToOne is a to-one resource relationship controller interface.

type ToOneGet

type ToOneGet func(ctx context.Context, id string) (*jsh.IDObject, jsh.ErrorType)

Get the relationship of a resource from storage.

type ToOneUpdate

type ToOneUpdate func(ctx context.Context, id string, relationship *jsh.IDObject) (*jsh.IDObject, jsh.ErrorType)

Update an existing relationship in storage.

type Update

type Update func(ctx context.Context, object *jsh.Object) (*jsh.Object, jsh.ErrorType)

Update an existing object in storage.

Jump to

Keyboard shortcuts

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