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

Unified Diff: service/datastore/properties.go

Issue 1259593005: Add 'user friendly' datastore API. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: 100% coverage of new code 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/datastore/properties.go
diff --git a/service/rawdatastore/properties.go b/service/datastore/properties.go
similarity index 97%
rename from service/rawdatastore/properties.go
rename to service/datastore/properties.go
index 388afba8506d41c874c6e249bfd6c6c301a7f63f..d9a4907bd78d85ca4fc4c08030efae3d4d42776d 100644
--- a/service/rawdatastore/properties.go
+++ b/service/datastore/properties.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-package rawdatastore
+package datastore
import (
"errors"
@@ -331,11 +331,18 @@ type PropertyLoadSaver interface {
Save(withMeta bool) (PropertyMap, error)
// GetMeta will get information about the field which has the struct tag in
- // the form of `gae:"$<key>[,<value>]?"`.
+ // the form of `gae:"$<key>[,<default>]?"`.
//
- // string and int64 fields will return the <value> in the struct tag,
- // converted to the appropriate type, if the field has the zero value.
+ // Supported metadata types are:
+ // int64 - may have default (ascii encoded base-10)
+ // string - may have default
+ // Toggle - MUST have default ("true" or "false")
+ // Key - NO default allowed
//
+ // Struct fields of type Toggle (which is an Auto/On/Off) require 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.
// Example:
// type MyStruct struct {
// CoolField int64 `gae:"$id,1"`
@@ -348,12 +355,6 @@ type PropertyLoadSaver interface {
// // val == 10
// // err == nil
//
- // Struct fields of type Toggle (which is an Auto/On/Off) 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 Toggle, a <value> MUST be specified.
- //
- // Example:
// type MyStruct struct {
// TFlag Toggle `gae:"$flag1,true"` // defaults to true
// FFlag Toggle `gae:"$flag2,false"` // defaults to false

Powered by Google App Engine
This is Rietveld 408576698