-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrestaurant.go
35 lines (27 loc) · 921 Bytes
/
restaurant.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package store
import "github.com/incrypt0/cokut-server/models"
// InsertRestaurant Function to insert restaurants into db
func (s *Store) InsertRestaurant(r *models.Restaurant) (id string, err error) {
// Getting the user colection
c := s.rc
// Basic Validation
if err = r.Validate(); err != nil {
return id, err
}
if err != nil {
return id, err
}
return s.w.Add(c, r)
}
// GetAllRestaurants Function to get all restaurants
func (s *Store) GetAllRestaurants() (l []interface{}, err error) {
return s.w.Get(s.rc, models.Restaurant{})
}
// GetAllRestaurants Function to get all restaurants
func (s *Store) GetAllRegularRestaurants() (l []interface{}, err error) {
return s.w.Get(s.rc, models.Restaurant{Type: "regular"})
}
// GetAllHomeMade Function to get all home food centers
func (s *Store) GetAllHomeMade() (l []interface{}, err error) {
return s.w.Get(s.rc, models.Restaurant{Type: "home"})
}