| 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 // HEAVILY adapted from github.com/golang/appengine/datastore | 5 // HEAVILY adapted from github.com/golang/appengine/datastore |
| 6 | 6 |
| 7 package rawdatastore | 7 package datastore |
| 8 | 8 |
| 9 import ( | 9 import ( |
| 10 "fmt" | 10 "fmt" |
| 11 "reflect" | 11 "reflect" |
| 12 "strconv" | 12 "strconv" |
| 13 "strings" | 13 "strings" |
| 14 "sync" | 14 "sync" |
| 15 "time" | 15 "time" |
| 16 "unicode" | 16 "unicode" |
| 17 | 17 |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 p.o.Field(idx).Set(reflect.ValueOf(val)) | 362 p.o.Field(idx).Set(reflect.ValueOf(val)) |
| 363 return nil | 363 return nil |
| 364 } | 364 } |
| 365 | 365 |
| 366 func (p *structPLS) Problem() error { return p.c.problem } | 366 func (p *structPLS) Problem() error { return p.c.problem } |
| 367 | 367 |
| 368 var ( | 368 var ( |
| 369 // The RWMutex is chosen intentionally, as the majority of access to the | 369 // The RWMutex is chosen intentionally, as the majority of access to the |
| 370 // structCodecs map will be in parallel and will be to read an existing
codec. | 370 // structCodecs map will be in parallel and will be to read an existing
codec. |
| 371 // There's no reason to serialize goroutines on every | 371 // There's no reason to serialize goroutines on every |
| 372 » // gae.RawDatastore.{Get,Put}{,Multi} call. | 372 » // gae.datastore.{Get,Put}{,Multi} call. |
| 373 structCodecsMutex sync.RWMutex | 373 structCodecsMutex sync.RWMutex |
| 374 structCodecs = map[reflect.Type]*structCodec{} | 374 structCodecs = map[reflect.Type]*structCodec{} |
| 375 ) | 375 ) |
| 376 | 376 |
| 377 // validPropertyName returns whether name consists of one or more valid Go | 377 // validPropertyName returns whether name consists of one or more valid Go |
| 378 // identifiers joined by ".". | 378 // identifiers joined by ".". |
| 379 func validPropertyName(name string) bool { | 379 func validPropertyName(name string) bool { |
| 380 if name == "" { | 380 if name == "" { |
| 381 return false | 381 return false |
| 382 } | 382 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 switch val { | 572 switch val { |
| 573 case "on", "On", "true": | 573 case "on", "On", "true": |
| 574 return true, nil | 574 return true, nil |
| 575 case "off", "Off", "false": | 575 case "off", "Off", "false": |
| 576 return false, nil | 576 return false, nil |
| 577 } | 577 } |
| 578 return nil, fmt.Errorf("Toggle field has bad/missing default, go
t %q", val) | 578 return nil, fmt.Errorf("Toggle field has bad/missing default, go
t %q", val) |
| 579 } | 579 } |
| 580 return nil, fmt.Errorf("helper: meta field with bad type/value %s/%q", t
, val) | 580 return nil, fmt.Errorf("helper: meta field with bad type/value %s/%q", t
, val) |
| 581 } | 581 } |
| OLD | NEW |