satisfeet / hoopoe-old

Hoopoe is the REST API service for satisfeet.
1 stars 0 forks source link

merge mongo package into store package #33

Closed bodokaiser closed 10 years ago

bodokaiser commented 10 years ago

Though I tend to always have a mongo package it is actually not good as it always leads to rewriting a third class mgo interface.

As this is nothing urgent I will leave the mongo package outside but when there are more features to handle and the mongo.Store interface is limiting again I will merge that stuff into store.store.

bodokaiser commented 10 years ago

Needs to be done before we can merge #34 also needs planning.

bodokaiser commented 10 years ago

Problem: How to separate concrete types (e.g. Order, Product, Customer) from abstract types (e.g. Store, Query)? Solution: Put them together for now.

Problem: How create connection? Solution: Just use bare mgo.Session.

bodokaiser commented 10 years ago

Possible structure of Store:

type Store struct {
    session *mgo.Session
    database *mgo.Database
}

func (s *Store) Find(model interface{}) error {

}

func (s *Store) FindOne(model interface{}) error {

}

func (s *Store) Create(model interface{}) error {

}

func (s *Store) Update(model interface{}) error {

}

func (s *Store) Remove(model interface{}) error {

}

func (s *Store) files(model interface{}) *mgo.GridFS {

}

func (s *Store) collection(model interface{}) *mgo.Collection {

}