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

Unified Diff: service/datastore/pls.go

Issue 1401533007: Add ability to override just the metadata in a struct. (Closed) Base URL: https://github.com/luci/gae.git@add_exists_method
Patch Set: comment Created 5 years, 2 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 | « no previous file | service/datastore/pls_impl.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/pls.go
diff --git a/service/datastore/pls.go b/service/datastore/pls.go
index 86613728527adaa902537557c0f750c4fb462033..e3bb3194fb8a8d57a85f045c4c125a02c9d21306 100644
--- a/service/datastore/pls.go
+++ b/service/datastore/pls.go
@@ -86,6 +86,13 @@ import (
// // 'Lines' will serialized to the datastore in the field 'Lines'
// Lines []string
// }
+//
+// A pointer-to-struct may also implement MetaGetterSetter to provide more
+// sophistocated metadata values. Explicitly defined fields (as shown above)
+// always take precedence over fields manipulated by the MetaGetterSetter
+// methods. So if your GetMeta handles "kind", but you explicitly have a
+// $kind field, the $kind field will take precedence and your GetMeta
+// implementation will not be called for "kind".
func GetPLS(obj interface{}) PropertyLoadSaver {
v := reflect.ValueOf(obj)
if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct {
« no previous file with comments | « no previous file | service/datastore/pls_impl.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698