Mercurial > gemma
view pkg/imports/report.go @ 5332:9df7b39297ed extented-report
Merged.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 01 Jun 2021 00:23:25 +0200 |
parents | 795a0a0b5047 |
children | 45805c454436 |
line wrap: on
line source
// This is Free Software under GNU Affero General Public License v >= 3.0 // without warranty, see README.md and license for details. // // SPDX-License-Identifier: AGPL-3.0-or-later // License-Filename: LICENSES/AGPL-3.0.txt // // Copyright (C) 2018 by via donau // – Österreichische Wasserstraßen-Gesellschaft mbH // Software engineering by Intevation GmbH // // Author(s): // * Sascha L. Teichmann <sascha.teichmann@intevation.de> package imports import ( "context" "database/sql" "errors" "gemma.intevation.de/gemma/pkg/common" "gemma.intevation.de/gemma/pkg/models" ) type Report struct { models.QueueConfigurationType Name string `json:"Name"` } const ReportJobKind JobKind = "report" type reportJobCreator struct{} func init() { RegisterJobCreator(ReportJobKind, reportJobCreator{}) } func (reportJobCreator) Description() string { return "report" } func (reportJobCreator) AutoAccept() bool { return true } func (reportJobCreator) Create() Job { return new(Report) } func (reportJobCreator) Depends() [2][]string { return [2][]string{{}, {}} } func (reportJobCreator) StageDone(context.Context, *sql.Tx, int64, Feedback) error { return nil } func (r *Report) Description() (string, error) { return r.Name, nil } func (*Report) CleanUp() error { return nil } func (r *Report) MarshalAttributes(attrs common.Attributes) error { if err := r.QueueConfigurationType.MarshalAttributes(attrs); err != nil { return err } attrs.Set("name", r.Name) return nil } func (r *Report) UnmarshalAttributes(attrs common.Attributes) error { if err := r.QueueConfigurationType.UnmarshalAttributes(attrs); err != nil { return err } name, found := attrs.Get("name") if !found { return errors.New("missing 'name' attribute") } r.Name = name return nil } func (r *Report) Do( ctx context.Context, importID int64, conn *sql.Conn, feedback Feedback, ) (interface{}, error) { // TODO: Implement me! return nil, nil }