Chromium Code Reviews| Index: service/rawdatastore/types.go |
| diff --git a/service/rawdatastore/types.go b/service/rawdatastore/types.go |
| index 9b426ad3ff4e35db1ba2213610aa9b6c37aae61d..42c127af0c6fcd37ca0e5c3b37ed28016ab8d517 100644 |
| --- a/service/rawdatastore/types.go |
| +++ b/service/rawdatastore/types.go |
| @@ -4,6 +4,10 @@ |
| package rawdatastore |
| +import ( |
| + "fmt" |
| +) |
| + |
| // ByteString is a short byte slice (up to 1500 bytes) that can be indexed. |
| type ByteString []byte |
| @@ -37,3 +41,27 @@ type TransactionOptions struct { |
| // due to a conflicting transaction. If omitted, it defaults to 3. |
| Attempts int |
| } |
| + |
| +// Toggle is a tri-state boolean (Auto/True/False), which allows structs |
| +// 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
|
| +type Toggle byte |
| + |
| +// These are the allowed values for Toggle. Any other values are invalid. |
| +const ( |
| + Auto Toggle = iota |
| + On |
| + Off |
| +) |
| + |
| +func (b Toggle) String() string { |
| + switch b { |
| + case Auto: |
| + return "Auto" |
| + case On: |
| + return "On" |
| + case Off: |
| + return "Off" |
| + default: |
| + return fmt.Sprintf("UNKNOWN_Toggle(%d)", b) |
| + } |
| +} |