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

Unified Diff: service/rawdatastore/types.go

Issue 1259463002: Add BoolFlag for rawdatastore. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: 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..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)
+ }
+}
« 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