Chromium Code Reviews| 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 // Toggle is a tri-state boolean (Auto/True/False), which allows structs | |
| 46 // to control boolean flags for metadata in a non-ambiguous way. | |
|
Vadim Sh.
2015/07/24 18:53:00
what is Auto? It IS ambiguous, at leas from readin
iannucci
2015/07/24 20:58:10
Auto means 'use the default in the field tag'. I'v
| |
| 47 type Toggle byte | |
| 48 | |
| 49 // These are the allowed values for Toggle. Any other values are invalid. | |
| 50 const ( | |
| 51 Auto Toggle = iota | |
| 52 On | |
| 53 Off | |
| 54 ) | |
| 55 | |
| 56 func (b Toggle) String() string { | |
| 57 switch b { | |
| 58 case Auto: | |
| 59 return "Auto" | |
| 60 case On: | |
| 61 return "On" | |
| 62 case Off: | |
| 63 return "Off" | |
| 64 default: | |
| 65 return fmt.Sprintf("UNKNOWN_Toggle(%d)", b) | |
| 66 } | |
| 67 } | |
| OLD | NEW |