pseudodb

package
v2.12.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2015 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	*sync.RWMutex `json:"-"`

	GET    *route.Route `json:"-"`
	PATCH  *route.Route `json:"-"`
	POST   *route.Route `json:"-"`
	DELETE *route.Route `json:"-"`
	INDEX  *route.Route `json:"-"`

	Data         map[string]interface{}
	BeforeDelete func(interface{}) error `json:"-"`
	// contains filtered or unexported fields
}

func NewApp

func NewApp(store Store, types ...Storable) *App

NewApp creates a new app, storing in store (if not nil). types are pointers to instances of the types that should be stored the types must be in the order of their dependencies, i.e. non dependant types come first. this is important when reloading the data from the store

func (*App) Delete

func (a *App) Delete(val Storable)

func (*App) Find

func (a *App) Find(key string) (val interface{}, found bool)

func (*App) List

func (a *App) List(val Storable) map[string]interface{}

List returns the current list for the given pointer to type instance

func (*App) Load

func (a *App) Load() error

func (*App) MarshalJSON

func (a *App) MarshalJSON() ([]byte, error)

func (*App) New

func (a *App) New(val Storable) (uuid_ string)

func (*App) RegisterRoutes

func (a *App) RegisterRoutes(rt *router.Router)

func (*App) UnmarshalJSON

func (a *App) UnmarshalJSON(by []byte) error

func (*App) Update

func (a *App) Update(val Storable)

type FileStore

type FileStore struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

func (*FileStore) Load

func (fs *FileStore) Load(a *App) error

func (*FileStore) Save

func (fs *FileStore) Save(a *App) error

type Storable

type Storable interface {
	SetUUID(string)
	UUID() string
}

type Store

type Store interface {
	Save(*App) error
	Load(*App) error
}

func NewFileStore

func NewFileStore(filename string) Store

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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