-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecords.go
82 lines (68 loc) · 2.03 KB
/
records.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package apidCRUD
// ----- types for parameter record and response structures
// field tags are used to change the case of JSON keys
// created by json.Unmarshal().
// NumChangedResponse is the response data for API deleteDbRecord and others.
type NumChangedResponse struct {
NumChanged int64 `json:"numChanged"`
Kind string `json:"kind"`
}
// ErrorResponse is the response data for API errors.
type ErrorResponse struct {
Code int `json:"code"`
Message string `json:"message"`
Kind string `json:"kind"`
}
// KVRecord represents record data in requests, used in multiple APIs.
type KVRecord struct {
Keys []string
Values []interface{}
}
// BodyRecord is the body data for APIs that create or update database records.
type BodyRecord struct {
Records []KVRecord
}
// KVResponse represents data records returned from an API call.
type KVResponse struct {
Keys []string `json:"keys"`
Values []interface{} `json:"values"`
Kind string `json:"kind"`
Self string `json:"self"`
}
// RecordsResponse is the type for multiple get*Record* APIs.
type RecordsResponse struct {
Records []*KVResponse `json:"records"`
Kind string `json:"kind"`
}
// IdsResponse is the type returned by createDbRecords .
type IdsResponse struct {
Ids []int64 `json:"ids"`
Kind string `json:"kind"`
}
// TablesResponse is the type returned by getDbTables.
type TablesResponse struct {
Names []string `json:"names"`
Kind string `json:"kind"`
Self string `json:"self"`
}
// FieldSchema is the type used to specify a field in a table.
type FieldSchema struct {
Name string
Properties []string
}
// TableSchema is the type used to describe one table to be created.
type TableSchema struct {
Fields []FieldSchema
}
// SchemaResponse is the response format for table creation.
type SchemaResponse struct {
Schema string `json:"schema"`
Kind string `json:"kind"`
Self string `json:"self"`
}
// ServiceResponse is the response format for the describeService API.
type ServiceResponse struct {
Description string `json:"resource"`
Kind string `json:"kind"`
Self string `json:"self"`
}