-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.go
61 lines (44 loc) · 930 Bytes
/
models.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package ridemerge
// User model
type User struct {
FirstName string
LastName string
Email string
Password string
Trips []Trip
}
// Session model
type Session struct {
User
LoggedIn bool
SearchResults []Trip
}
// RidePost model
type Trip struct {
Event string
CreatedBy string
Origin string
Destination string
DDate string
DTime string
HasCar string
Seats int
}
type UserDatabase interface {
ListUsers() ([]User, error)
GetUser(email string) (User, error)
PutUser(u User) error
DeleteUser(email string) error
UpdateUser(u User) error
Close()
}
type TripDatabase interface {
ListTrips() ([]Trip, error)
ListTripsWithDestination(dest string) ([]Trip, error)
ListTripsCreatedBy(createdBy string) ([]Trip, error)
GetTrip(event string) (Trip, error)
PutTrip(t Trip) error
UpdateTrip(t Trip) error
DeleteTrip(event string) error
Close()
}