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 package datastore | 5 package datastore |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "reflect" | 9 "reflect" |
10 | 10 |
| 11 "github.com/luci/gae" |
11 "google.golang.org/appengine/datastore" | 12 "google.golang.org/appengine/datastore" |
12 ) | 13 ) |
13 | 14 |
14 // These errors are returned by various datastore.Interface methods. | 15 // These errors are returned by various datastore.Interface methods. |
15 var ( | 16 var ( |
16 ErrInvalidKey = datastore.ErrInvalidKey | 17 ErrInvalidKey = datastore.ErrInvalidKey |
17 ErrNoSuchEntity = datastore.ErrNoSuchEntity | 18 ErrNoSuchEntity = datastore.ErrNoSuchEntity |
18 ErrConcurrentTransaction = datastore.ErrConcurrentTransaction | 19 ErrConcurrentTransaction = datastore.ErrConcurrentTransaction |
| 20 |
| 21 // Stop is an alias for "github.com/luci/gae".Stop |
| 22 Stop = gae.Stop |
19 ) | 23 ) |
20 | 24 |
21 // ErrFieldMismatch is returned when a field is to be loaded into a different | 25 // ErrFieldMismatch is returned when a field is to be loaded into a different |
22 // type than the one it was stored from, or when a field is missing or | 26 // type than the one it was stored from, or when a field is missing or |
23 // unexported in the destination struct. | 27 // unexported in the destination struct. |
24 // StructType is the type of the struct pointed to by the destination argument | 28 // StructType is the type of the struct pointed to by the destination argument |
25 // passed to Get or to Iterator.Next. | 29 // passed to Get or to Iterator.Next. |
26 type ErrFieldMismatch struct { | 30 type ErrFieldMismatch struct { |
27 StructType reflect.Type | 31 StructType reflect.Type |
28 FieldName string | 32 FieldName string |
29 Reason string | 33 Reason string |
30 } | 34 } |
31 | 35 |
32 func (e *ErrFieldMismatch) Error() string { | 36 func (e *ErrFieldMismatch) Error() string { |
33 return fmt.Sprintf("gae: cannot load field %q into a %q: %s", | 37 return fmt.Sprintf("gae: cannot load field %q into a %q: %s", |
34 e.FieldName, e.StructType, e.Reason) | 38 e.FieldName, e.StructType, e.Reason) |
35 } | 39 } |
OLD | NEW |