Mercurial > gemma
comparison pkg/imports/report.go @ 5329:795a0a0b5047 extented-report
Embed scheduling type into report import to ensure persistence of schedule data.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 31 May 2021 10:10:31 +0200 |
parents | bc8c082487b2 |
children | 45805c454436 |
comparison
equal
deleted
inserted
replaced
5328:bc8c082487b2 | 5329:795a0a0b5047 |
---|---|
17 "context" | 17 "context" |
18 "database/sql" | 18 "database/sql" |
19 "errors" | 19 "errors" |
20 | 20 |
21 "gemma.intevation.de/gemma/pkg/common" | 21 "gemma.intevation.de/gemma/pkg/common" |
22 "gemma.intevation.de/gemma/pkg/models" | |
22 ) | 23 ) |
23 | 24 |
24 type Report struct { | 25 type Report struct { |
26 models.QueueConfigurationType | |
25 Name string `json:"Name"` | 27 Name string `json:"Name"` |
26 } | 28 } |
27 | 29 |
28 const ReportJobKind JobKind = "report" | 30 const ReportJobKind JobKind = "report" |
29 | 31 |
46 func (r *Report) Description() (string, error) { return r.Name, nil } | 48 func (r *Report) Description() (string, error) { return r.Name, nil } |
47 | 49 |
48 func (*Report) CleanUp() error { return nil } | 50 func (*Report) CleanUp() error { return nil } |
49 | 51 |
50 func (r *Report) MarshalAttributes(attrs common.Attributes) error { | 52 func (r *Report) MarshalAttributes(attrs common.Attributes) error { |
53 if err := r.QueueConfigurationType.MarshalAttributes(attrs); err != nil { | |
54 return err | |
55 } | |
51 attrs.Set("name", r.Name) | 56 attrs.Set("name", r.Name) |
52 return nil | 57 return nil |
53 } | 58 } |
54 | 59 |
55 func (r *Report) UnmarshalAttributes(attrs common.Attributes) error { | 60 func (r *Report) UnmarshalAttributes(attrs common.Attributes) error { |
61 if err := r.QueueConfigurationType.UnmarshalAttributes(attrs); err != nil { | |
62 return err | |
63 } | |
56 name, found := attrs.Get("name") | 64 name, found := attrs.Get("name") |
57 if !found { | 65 if !found { |
58 return errors.New("missing 'name' attribute") | 66 return errors.New("missing 'name' attribute") |
59 } | 67 } |
60 r.Name = name | 68 r.Name = name |