Chromium Code Reviews| Index: service/rawdatastore/types.go |
| diff --git a/service/rawdatastore/types.go b/service/rawdatastore/types.go |
| index 9b426ad3ff4e35db1ba2213610aa9b6c37aae61d..e283fa50b36a2f1e5444e75148bb6578f527209d 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 |
| } |
| + |
| +// BoolFlag is a tri-state boolean (Auto/True/False), which allows structs |
| +// to control boolean flags for metadata in a non-ambiguous way. |
| +type BoolFlag byte |
| + |
| +// These are the allowed values for BoolFlag. Any other values are invalid. |
| +const ( |
| + Auto BoolFlag = iota |
| + True |
| + False |
| +) |
| + |
| +func (b BoolFlag) String() string { |
| + switch b { |
| + case Auto: |
| + return "Auto" |
| + case True: |
| + return "True" |
|
dnj (Google)
2015/07/24 16:11:37
not: Perhaps lowercase "true"/"false", as that's w
|
| + case False: |
| + return "False" |
| + default: |
| + return fmt.Sprintf("UNKNOWN_BoolFlag(%d)", b) |
| + } |
| +} |