go-json-spec-handler: github.com/derekdowling/go-json-spec-handler/jsh-api/store Index | Files

package store

import "github.com/derekdowling/go-json-spec-handler/jsh-api/store"

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


Package Files


type CRUD Uses

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 implements all sub-storage functions

type Delete Uses

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

Delete an object from storage by id

type Get Uses

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 Uses

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

List all instances of a resource from storage

type Save Uses

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

Save a new resource to storage

type ToMany Uses

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

ToMany retrieves a list of objects of a single resource type that are related to the provided resource id

type Update Uses

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

Update an existing object in storage

Package store imports 2 packages (graph) and is imported by 1 packages. Updated 2017-07-12. Refresh now. Tools for package owners.