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

Side by Side Diff: service/datastore/raw_interface.go

Issue 1516173002: Fix error message from KeyForObj when passing an invalid struct. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: Fix GetMetaDefault silliness Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package datastore 5 package datastore
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 9
10 "golang.org/x/net/context" 10 "golang.org/x/net/context"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return inner 75 return inner
76 } 76 }
77 77
78 // GetMeta is like PropertyLoadSaver.GetMeta, but it also takes an index 78 // GetMeta is like PropertyLoadSaver.GetMeta, but it also takes an index
79 // indicating which slot you want metadata for. If idx isn't there, this 79 // indicating which slot you want metadata for. If idx isn't there, this
80 // returns (nil, ErrMetaFieldUnset). 80 // returns (nil, ErrMetaFieldUnset).
81 func (m MultiMetaGetter) GetMeta(idx int, key string) (interface{}, error) { 81 func (m MultiMetaGetter) GetMeta(idx int, key string) (interface{}, error) {
82 return m.GetSingle(idx).GetMeta(key) 82 return m.GetSingle(idx).GetMeta(key)
83 } 83 }
84 84
85 // GetMetaDefault is like PropertyLoadSaver.GetMetaDefault, but it also takes an
86 // index indicating which slot you want metadata for. If idx isn't there, this
87 // returns dflt.
88 func (m MultiMetaGetter) GetMetaDefault(idx int, key string, dflt interface{}) i nterface{} {
89 return m.GetSingle(idx).GetMetaDefault(key, dflt)
90 }
91
92 // GetSingle gets a single MetaGetter at the specified index. 85 // GetSingle gets a single MetaGetter at the specified index.
93 func (m MultiMetaGetter) GetSingle(idx int) MetaGetter { 86 func (m MultiMetaGetter) GetSingle(idx int) MetaGetter {
94 if idx >= len(m) || m[idx] == nil { 87 if idx >= len(m) || m[idx] == nil {
95 return nullMetaGetter 88 return nullMetaGetter
96 } 89 }
97 return m[idx] 90 return m[idx]
98 } 91 }
99 92
100 // RawInterface implements the datastore functionality without any of the fancy 93 // RawInterface implements the datastore functionality without any of the fancy
101 // reflection stuff. This is so that Filters can avoid doing lots of redundant 94 // reflection stuff. This is so that Filters can avoid doing lots of redundant
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // - len(keys) > 0 161 // - len(keys) > 0
169 // - all keys are Valid, !Incomplete, and in the current namespace 162 // - all keys are Valid, !Incomplete, and in the current namespace
170 // - none keys of the keys are 'special' (use a kind prefixed with '__ ') 163 // - none keys of the keys are 'special' (use a kind prefixed with '__ ')
171 // - cb is not nil 164 // - cb is not nil
172 DeleteMulti(keys []*Key, cb DeleteMultiCB) error 165 DeleteMulti(keys []*Key, cb DeleteMultiCB) error
173 166
174 // Testable returns the Testable interface for the implementation, or ni l if 167 // Testable returns the Testable interface for the implementation, or ni l if
175 // there is none. 168 // there is none.
176 Testable() Testable 169 Testable() Testable
177 } 170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698