OLD | NEW |
1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // that can be found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // AUTOGENERATED: Do not edit | 5 // AUTOGENERATED: Do not edit |
6 | 6 |
7 package dm | 7 package dm |
8 | 8 |
9 import ( | 9 import ( |
10 "github.com/golang/protobuf/proto" | 10 "github.com/golang/protobuf/proto" |
11 | 11 |
12 "github.com/luci/gae/service/datastore" | 12 "github.com/luci/gae/service/datastore" |
13 ) | 13 ) |
14 | 14 |
| 15 var _ datastore.PropertyConverter = (*AbnormalFinish)(nil) |
| 16 |
| 17 // ToProperty implements datastore.PropertyConverter. It causes an embedded |
| 18 // 'AbnormalFinish' to serialize to an unindexed '[]byte' when used with the |
| 19 // "github.com/luci/gae" library. |
| 20 func (p *AbnormalFinish) ToProperty() (prop datastore.Property, err error) { |
| 21 data, err := proto.Marshal(p) |
| 22 if err == nil { |
| 23 prop.SetValue(data, datastore.NoIndex) |
| 24 } |
| 25 return |
| 26 } |
| 27 |
| 28 // FromProperty implements datastore.PropertyConverter. It parses a '[]byte' |
| 29 // into an embedded 'AbnormalFinish' when used with the "github.com/luci/gae" li
brary. |
| 30 func (p *AbnormalFinish) FromProperty(prop datastore.Property) error { |
| 31 data, err := prop.Project(datastore.PTBytes) |
| 32 if err != nil { |
| 33 return err |
| 34 } |
| 35 return proto.Unmarshal(data.([]byte), p) |
| 36 } |
| 37 |
| 38 var _ datastore.PropertyConverter = (*Execution_Auth)(nil) |
| 39 |
| 40 // ToProperty implements datastore.PropertyConverter. It causes an embedded |
| 41 // 'Execution_Auth' to serialize to an unindexed '[]byte' when used with the |
| 42 // "github.com/luci/gae" library. |
| 43 func (p *Execution_Auth) ToProperty() (prop datastore.Property, err error) { |
| 44 data, err := proto.Marshal(p) |
| 45 if err == nil { |
| 46 prop.SetValue(data, datastore.NoIndex) |
| 47 } |
| 48 return |
| 49 } |
| 50 |
| 51 // FromProperty implements datastore.PropertyConverter. It parses a '[]byte' |
| 52 // into an embedded 'Execution_Auth' when used with the "github.com/luci/gae" li
brary. |
| 53 func (p *Execution_Auth) FromProperty(prop datastore.Property) error { |
| 54 data, err := prop.Project(datastore.PTBytes) |
| 55 if err != nil { |
| 56 return err |
| 57 } |
| 58 return proto.Unmarshal(data.([]byte), p) |
| 59 } |
| 60 |
15 var _ datastore.PropertyConverter = (*Quest_Desc)(nil) | 61 var _ datastore.PropertyConverter = (*Quest_Desc)(nil) |
16 | 62 |
17 // ToProperty implements datastore.PropertyConverter. It causes an embedded | 63 // ToProperty implements datastore.PropertyConverter. It causes an embedded |
18 // 'Quest_Desc' to serialize to an unindexed '[]byte' when used with the | 64 // 'Quest_Desc' to serialize to an unindexed '[]byte' when used with the |
19 // "github.com/luci/gae" library. | 65 // "github.com/luci/gae" library. |
20 func (p *Quest_Desc) ToProperty() (prop datastore.Property, err error) { | 66 func (p *Quest_Desc) ToProperty() (prop datastore.Property, err error) { |
21 data, err := proto.Marshal(p) | 67 data, err := proto.Marshal(p) |
22 if err == nil { | 68 if err == nil { |
23 prop.SetValue(data, datastore.NoIndex) | 69 prop.SetValue(data, datastore.NoIndex) |
24 } | 70 } |
(...skipping 25 matching lines...) Expand all Loading... |
50 | 96 |
51 // FromProperty implements datastore.PropertyConverter. It parses a '[]byte' | 97 // FromProperty implements datastore.PropertyConverter. It parses a '[]byte' |
52 // into an embedded 'Quest_TemplateSpec' when used with the "github.com/luci/gae
" library. | 98 // into an embedded 'Quest_TemplateSpec' when used with the "github.com/luci/gae
" library. |
53 func (p *Quest_TemplateSpec) FromProperty(prop datastore.Property) error { | 99 func (p *Quest_TemplateSpec) FromProperty(prop datastore.Property) error { |
54 data, err := prop.Project(datastore.PTBytes) | 100 data, err := prop.Project(datastore.PTBytes) |
55 if err != nil { | 101 if err != nil { |
56 return err | 102 return err |
57 } | 103 } |
58 return proto.Unmarshal(data.([]byte), p) | 104 return proto.Unmarshal(data.([]byte), p) |
59 } | 105 } |
OLD | NEW |