Mercurial > gemma
diff pkg/imports/report.go @ 5601:1222b777f51f
Made golint finally happy.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 06 Aug 2022 02:09:57 +0200 |
parents | 9967a78e43f4 |
children | 2dd155cc95ec |
line wrap: on
line diff
--- a/pkg/imports/report.go Sat Aug 06 00:46:21 2022 +0200 +++ b/pkg/imports/report.go Sat Aug 06 02:09:57 2022 +0200 @@ -36,11 +36,14 @@ "github.com/xuri/excelize/v2" ) +// Report is a job to generate a report and send emails to the +// receivers. type Report struct { models.QueueConfigurationType Name models.SafePath `json:"name"` } +// ReportJobKind is the unique name of this import job type. const ReportJobKind JobKind = "report" type reportJobCreator struct{} @@ -87,10 +90,13 @@ // RequiresRoles enforces to be a sys_admin to run this . func (*Report) RequiresRoles() auth.Roles { return auth.Roles{"sys_admin"} } +// Description gives a short info about relevant facts of this import. func (r *Report) Description([]string) (string, error) { return string(r.Name), nil } +// CleanUp is an empty implementation. func (*Report) CleanUp() error { return nil } +// MarshalAttributes implements a DB marshaling of this job. func (r *Report) MarshalAttributes(attrs common.Attributes) error { if err := r.QueueConfigurationType.MarshalAttributes(attrs); err != nil { return err @@ -99,6 +105,7 @@ return nil } +// UnmarshalAttributes implements a DB unmarshaling of this job. func (r *Report) UnmarshalAttributes(attrs common.Attributes) error { if err := r.QueueConfigurationType.UnmarshalAttributes(attrs); err != nil { return err @@ -154,6 +161,7 @@ return template, action, nil } +// Do executes the actual report generation. func (r *Report) Do( ctx context.Context, importID int64,