OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package rawdatastore | 5 package rawdatastore |
6 | 6 |
7 import ( | |
8 "fmt" | |
9 ) | |
10 | |
7 // ByteString is a short byte slice (up to 1500 bytes) that can be indexed. | 11 // ByteString is a short byte slice (up to 1500 bytes) that can be indexed. |
8 type ByteString []byte | 12 type ByteString []byte |
9 | 13 |
10 // GeoPoint represents a location as latitude/longitude in degrees. | 14 // GeoPoint represents a location as latitude/longitude in degrees. |
11 // | 15 // |
12 // You probably shouldn't use these, but their inclusion here is so that the | 16 // You probably shouldn't use these, but their inclusion here is so that the |
13 // RawDatastore can interact (and round-trip) correctly with other datastore API | 17 // RawDatastore can interact (and round-trip) correctly with other datastore API |
14 // implementations. | 18 // implementations. |
15 type GeoPoint struct { | 19 type GeoPoint struct { |
16 Lat, Lng float64 | 20 Lat, Lng float64 |
(...skipping 13 matching lines...) Expand all Loading... | |
30 // have the same behavior as single group transactions. In particular, i t | 34 // have the same behavior as single group transactions. In particular, i t |
31 // is much more likely to see partially applied transactions in differen t | 35 // is much more likely to see partially applied transactions in differen t |
32 // entity groups, in global queries. | 36 // entity groups, in global queries. |
33 // It is valid to set XG to true even if the transaction is within a | 37 // It is valid to set XG to true even if the transaction is within a |
34 // single entity group. | 38 // single entity group. |
35 XG bool | 39 XG bool |
36 // Attempts controls the number of retries to perform when commits fail | 40 // Attempts controls the number of retries to perform when commits fail |
37 // due to a conflicting transaction. If omitted, it defaults to 3. | 41 // due to a conflicting transaction. If omitted, it defaults to 3. |
38 Attempts int | 42 Attempts int |
39 } | 43 } |
44 | |
45 // BoolFlag is a tri-state boolean (Auto/True/False), which allows structs | |
46 // to control boolean flags for metadata in a non-ambiguous way. | |
47 type BoolFlag byte | |
48 | |
49 // These are the allowed values for BoolFlag. Any other values are invalid. | |
50 const ( | |
51 Auto BoolFlag = iota | |
52 True | |
53 False | |
54 ) | |
55 | |
56 func (b BoolFlag) String() string { | |
57 switch b { | |
58 case Auto: | |
59 return "Auto" | |
60 case True: | |
61 return "True" | |
dnj (Google)
2015/07/24 16:11:37
not: Perhaps lowercase "true"/"false", as that's w
| |
62 case False: | |
63 return "False" | |
64 default: | |
65 return fmt.Sprintf("UNKNOWN_BoolFlag(%d)", b) | |
66 } | |
67 } | |
OLD | NEW |