-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstruct.go
More file actions
91 lines (72 loc) · 3.16 KB
/
struct.go
File metadata and controls
91 lines (72 loc) · 3.16 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package main
import (
"time"
"golang.org/x/net/context"
//"google.golang.org/appengine"
"google.golang.org/appengine/datastore"
)
// ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
// [START case_struct]
type Case struct {
Name string
Overview string
Featuring string
//FrequencyResponse string // Old field: Replacced by low/high
FrequencyLow int32
FrequencyHigh int32
Length int8 // uint8 = 0-255 (int8 = 127)
Width int8 // uint8 = 0-255 (int8 = 127)
Height int8 // uint8 = 0-255 (int8 = 127)
Weight int8 // uint8 = 0-255 (int8 = 127)
Battery int8 // uint8 = 0-255 (int8 = 127)
Notes string
Price int32 // uint16 = 0-65,535
Watts int16
Sold bool // bool - Mark as sold
DriverMultiplier string // float32 // 1.12345678 (eight digits from decimal point) -> Switch to string for precision
BlobKey string
DateAdded time.Time
}
// [END case_struct]
// caseKey returns the key used for all case entries.
func caseKey(ctx context.Context) *datastore.Key { // context.Context vs appengine.Context
// The string "default_case" here could be varied to have multiple types of cases.
return datastore.NewKey(ctx, "Case", "default_case", 0, nil)
}
// ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
// ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
// Images for each Case, and marking which one can be customized
// [START image_struct]
type CaseImage struct {
CaseId int64 // e.g. (4,767,482,418,036,736) uint64 = 0-18,446,744,073,709,551,615 uint32 = 0-4,294,967,295
BlobKey string //appengine.BlobKey // e.g. (ahBkZXZ-cG1kLWJvb21jYXNlcicLEgRDYXNlIgxkZWZhdWx0X2Nhc2UMCxIEQ2FzZRiAgICAgIC8CAw)
Customizable bool // bool - Mark as customizable
DateAdded time.Time
}
// [END image_struct]
// imageKey returns the key used for all case entries.
func caseImageKey(ctx context.Context) *datastore.Key { // context.Context vs appengine.Context
return datastore.NewKey(ctx, "CaseImage", "default_caseimage", 0, nil)
}
// ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
// ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
// [START driver_struct]
type Driver struct {
Name string
Type string // low/mid/high
Circle bool // bool - Mark as circle
//FrequencyResponse string // Old field: Replacced by low/high
FrequencyLow int32
FrequencyHigh int32
Weight int8 // uint8 = 0-255 (int8 = 127)
Diameter int16 // uint8 = 0-255 -> int8 = -128 - 127 vs. int16 = -32,768 - 32,767
Price int32 // uint16 = 0-65,535
BlobKey string
DateAdded time.Time
}
// [END driver_struct]
// driverKey returns the key used for all case entries.
func driverKey(ctx context.Context) *datastore.Key { // context.Context vs appengine.Context
return datastore.NewKey(ctx, "Driver", "default_driver", 0, nil)
}
// ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========