-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault_presets.go
58 lines (53 loc) · 1.76 KB
/
default_presets.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
package main
import (
"context"
"log"
"github.com/MicahParks/craigslist-vehicles/mongodb"
"github.com/MicahParks/craigslist-vehicles/types"
)
func main() {
col, err := mongodb.Init("Preset")
if err != nil {
log.Fatalln(err.Error())
}
candidates := &types.Preset{}
if err = candidates.MakeQuery("candidates", true, true, "", "", "",
false, false, "", "", "", "", make([]string, 0),
"richmond, lynchburg, frederick, washingtondc, norfolk", ""); err != nil {
log.Fatalln(err.Error())
}
candidates.Everyone = true
trucks := &types.Preset{}
if err = trucks.MakeQuery("trucks", false, false, "", "", "", true,
true, "ford", "80000", "20000", "", make([]string, 0),
"richmond, lynchburg, frederick, washingtondc, norfolk", "2005"); err != nil {
log.Fatalln(err.Error())
}
trucks.Everyone = true
micahs := &types.Preset{}
if err = micahs.MakeQuery("micahs", false, false, "50", "black",
"", false, true, "", "100000", "10000", "", make([]string, 0),
"richmond, lynchburg, frederick, washingtondc, norfolk", "2000"); err != nil {
log.Fatalln(err.Error())
}
micahs.Everyone = true
manzanoa := &types.Preset{}
if err = manzanoa.MakeQuery("manzanoa", false, false, "10", "red",
"", false, false, "nissan", "90000", "2000", "", make([]string, 0),
"richmond, lynchburg, frederick, washingtondc, norfolk", "1990"); err != nil {
log.Fatalln(err.Error())
}
manzanoa.Everyone = true
if _, err = col.InsertOne(context.TODO(), candidates); err != nil {
log.Fatalln(err.Error())
}
if _, err = col.InsertOne(context.TODO(), trucks); err != nil {
log.Fatalln(err.Error())
}
if _, err = col.InsertOne(context.TODO(), micahs); err != nil {
log.Fatalln(err.Error())
}
if _, err = col.InsertOne(context.TODO(), manzanoa); err != nil {
log.Fatalln(err.Error())
}
}