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

Unified Diff: service/rawdatastore/properties.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
Index: service/rawdatastore/properties.go
diff --git a/service/rawdatastore/properties.go b/service/rawdatastore/properties.go
index f1e0341b59ce539577bd59ae536eeec678bb991b..2092a5c73057e39b514eeed871d18402f43c31ea 100644
--- a/service/rawdatastore/properties.go
+++ b/service/rawdatastore/properties.go
@@ -347,6 +347,20 @@ type PropertyLoadSaver interface {
// val, err := helper.GetPLS(&MyStruct{10}).GetMeta("id")
// // val == 10
// // err == nil
+ //
+ // Struct fields of type BoolFlag (which is an Auto/False/True) allow you to
+ // specify a value of 'true' or 'false' for the default value of the struct
+ // tag, and GetMeta will return the combined value as a regular boolean true
+ // or false value. If a field is BoolFlag, and no <value> is specified,
+ // GetMeta will return false. A simple boolean field creates ambiguity with
+ // a default <value>.
+ //
+ // Example:
+ // type MyStruct struct {
+ // TFlag BoolFlag `gae:"$flag1,true"` // defaults to true
+ // FFlag BoolFlag `gae:"$flag2,false"` // defaults to false
+ // Flag BoolFlag `gae:"$flag3"` // defaults to false
+ // }
GetMeta(key string) (interface{}, error)
// SetMeta allows you to set the current value of the meta-keyed field.

Powered by Google App Engine
This is Rietveld 408576698