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 rawdatastore | 5 package rawdatastore |
6 | 6 |
7 import ( | 7 import ( |
8 "errors" | 8 "errors" |
9 "fmt" | 9 "fmt" |
10 "math" | 10 "math" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // time in a Property can only hold microseconds | 251 // time in a Property can only hold microseconds |
252 o = v.Interface().(time.Time).Round(time.Microsecond) | 252 o = v.Interface().(time.Time).Round(time.Microsecond) |
253 } | 253 } |
254 } | 254 } |
255 return o, t | 255 return o, t |
256 } | 256 } |
257 | 257 |
258 // Value returns the current value held by this property. It's guaranteed to | 258 // Value returns the current value held by this property. It's guaranteed to |
259 // be a valid value type (i.e. `p.SetValue(p.Value(), true)` will never return | 259 // be a valid value type (i.e. `p.SetValue(p.Value(), true)` will never return |
260 // an error). | 260 // an error). |
261 func (p Property) Value() interface{} { return p.value } | 261 func (p *Property) Value() interface{} { return p.value } |
262 | 262 |
263 // IndexSetting says weather or not the datastore should create indicies for | 263 // IndexSetting says weather or not the datastore should create indicies for |
264 // this value. | 264 // this value. |
265 func (p Property) IndexSetting() IndexSetting { return p.indexSetting } | 265 func (p *Property) IndexSetting() IndexSetting { return p.indexSetting } |
266 | 266 |
267 // Type is the PT* type of the data contained in Value(). | 267 // Type is the PT* type of the data contained in Value(). |
268 func (p Property) Type() PropertyType { return p.propType } | 268 func (p *Property) Type() PropertyType { return p.propType } |
269 | 269 |
270 // SetValue sets the Value field of a Property, and ensures that its value | 270 // SetValue sets the Value field of a Property, and ensures that its value |
271 // conforms to the permissible types. That way, you're guaranteed that if you | 271 // conforms to the permissible types. That way, you're guaranteed that if you |
272 // have a Property, its value is valid. | 272 // have a Property, its value is valid. |
273 // | 273 // |
274 // value is the property value. The valid types are: | 274 // value is the property value. The valid types are: |
275 // - int64 | 275 // - int64 |
276 // - bool | 276 // - bool |
277 // - string | 277 // - string |
278 // - float64 | 278 // - float64 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 return err | 430 return err |
431 } | 431 } |
432 pm["$"+key] = []Property{prop} | 432 pm["$"+key] = []Property{prop} |
433 return nil | 433 return nil |
434 } | 434 } |
435 | 435 |
436 // Problem implements PropertyLoadSaver.Problem. It ALWAYS returns nil. | 436 // Problem implements PropertyLoadSaver.Problem. It ALWAYS returns nil. |
437 func (pm PropertyMap) Problem() error { | 437 func (pm PropertyMap) Problem() error { |
438 return nil | 438 return nil |
439 } | 439 } |
OLD | NEW |