Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Unified Diff: service/rawdatastore/types.go

Issue 1259463002: Add BoolFlag for rawdatastore. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: improve error Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « service/rawdatastore/reflect.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
+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)
+ }
+}
« no previous file with comments | « service/rawdatastore/reflect.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698