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

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

Issue 1298423005: prod: fix timezone conversion from AppEngine layer (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Created 5 years, 4 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 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 "errors" 8 "errors"
9 "fmt" 9 "fmt"
10 "math" 10 "math"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 return PTString, nil 202 return PTString, nil
203 case Key: 203 case Key:
204 // TODO(riannucci): Check key for validity in its own namespace? 204 // TODO(riannucci): Check key for validity in its own namespace?
205 return PTKey, nil 205 return PTKey, nil
206 case time.Time: 206 case time.Time:
207 err := error(nil) 207 err := error(nil)
208 if checkValid && (x.Before(minTime) || x.After(maxTime)) { 208 if checkValid && (x.Before(minTime) || x.After(maxTime)) {
209 err = errors.New("time value out of range") 209 err = errors.New("time value out of range")
210 } 210 }
211 if checkValid && !timeLocationIsUTC(x.Location()) { 211 if checkValid && !timeLocationIsUTC(x.Location()) {
212 » » » err = fmt.Errorf("time value has wrong Location: %v %v", x.Location()) 212 » » » err = fmt.Errorf("time value has wrong Location: %v", x. Location())
iannucci 2015/08/19 21:55:26 cool, I was gonna fix this in my next CL :)
213 } 213 }
214 return PTTime, err 214 return PTTime, err
215 case GeoPoint: 215 case GeoPoint:
216 err := error(nil) 216 err := error(nil)
217 if checkValid && !x.Valid() { 217 if checkValid && !x.Valid() {
218 err = errors.New("invalid GeoPoint value") 218 err = errors.New("invalid GeoPoint value")
219 } 219 }
220 return PTGeoPoint, err 220 return PTGeoPoint, err
221 default: 221 default:
222 return PTUnknown, fmt.Errorf("gae: Property has bad type %T", v) 222 return PTUnknown, fmt.Errorf("gae: Property has bad type %T", v)
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 dflt = UpconvertUnderlyingType(dflt) 498 dflt = UpconvertUnderlyingType(dflt)
499 cur, err := gm(key) 499 cur, err := gm(key)
500 if err != nil { 500 if err != nil {
501 return dflt 501 return dflt
502 } 502 }
503 if dflt != nil && reflect.TypeOf(cur) != reflect.TypeOf(dflt) { 503 if dflt != nil && reflect.TypeOf(cur) != reflect.TypeOf(dflt) {
504 return dflt 504 return dflt
505 } 505 }
506 return cur 506 return cur
507 } 507 }
OLDNEW
« impl/prod/raw_datastore_type_converter.go ('K') | « impl/prod/raw_datastore_type_converter.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698