Finalize model

This commit is contained in:
Daniel 2018-09-05 17:05:51 +02:00
parent 94598b115b
commit 9b7365376c
13 changed files with 320 additions and 100 deletions

38
database/controller.go Normal file
View file

@ -0,0 +1,38 @@
package database
type Controller struct {
storage
writeLock sync.RWMutex
readLock sync.RWMutex
migrating *abool.AtomicBool
}
func NewController() (*Controller, error) {
}
// Retrieve
func (c *Controller) Exists(key string) (bool, error) {}
func (c *Controller) Get(key string) (model.Model, error) {}
// Modify
func (c *Controller) Create(model model.Model) error {}
// create when not exists
func (c *Controller) Update(model model.Model) error {}
// update, create if not exists.
func (c *Controller) UpdateOrCreate(model model.Model) error {}
func (c *Controller) Delete(key string) error {}
// Partial
// What happens if I mutate a value that does not yet exist? How would I know its type?
func (c *Controller) InsertPartial(key string, partialObject interface{}) {}
func (c *Controller) InsertValue(key string, attribute string, value interface{}) {}
// Query
func (c *Controller) Query(q *query.Query, local, internal bool) (*iterator.Iterator, error) {}
// Meta
func (c *Controller) SetAbsoluteExpiry(key string, time int64) {}
func (c *Controller) SetRelativateExpiry(key string, duration int64) {}
func (c *Controller) MakeCrownJewel(key string) {}
func (c *Controller) MakeSecret(key string) {}