OLD | NEW |
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 // +build appengine | 5 // +build appengine |
6 | 6 |
7 package meta | 7 package meta |
8 | 8 |
9 import ( | 9 import ( |
10 "appengine/datastore" | 10 "appengine/datastore" |
11 | 11 |
| 12 "github.com/luci/luci-go/common/errors" |
| 13 |
12 "infra/gae/libs/context" | 14 "infra/gae/libs/context" |
13 "infra/libs/errors" | |
14 ) | 15 ) |
15 | 16 |
16 var mark = errors.MakeMarkFn("eg") | 17 var mark = errors.MakeMarkFn("eg") |
17 | 18 |
18 // EntityGroupMeta is the model corresponding to the __entity_group__ model in | 19 // EntityGroupMeta is the model corresponding to the __entity_group__ model in |
19 // appengine. You shouldn't need to use this struct directly, but instead should | 20 // appengine. You shouldn't need to use this struct directly, but instead should |
20 // use GetEntityGroupVersion. | 21 // use GetEntityGroupVersion. |
21 type EntityGroupMeta struct { | 22 type EntityGroupMeta struct { |
22 _kind string `datastore:"-" goon:"kind,__entity_group__"` | 23 _kind string `datastore:"-" goon:"kind,__entity_group__"` |
23 | 24 |
(...skipping 14 matching lines...) Loading... |
38 err := c.Get(egm) | 39 err := c.Get(egm) |
39 if err != datastore.ErrNoSuchEntity { | 40 if err != datastore.ErrNoSuchEntity { |
40 err = mark(err) | 41 err = mark(err) |
41 } else { | 42 } else { |
42 // this is OK for callers. The version of the entity group is ef
fectively 0 | 43 // this is OK for callers. The version of the entity group is ef
fectively 0 |
43 // in this case. | 44 // in this case. |
44 err = nil | 45 err = nil |
45 } | 46 } |
46 return egm.Version, err | 47 return egm.Version, err |
47 } | 48 } |
OLD | NEW |