diff pkg/models/importbase.go @ 2042:d29ac997eb34 unify_imports

This breaks this branch!!!! Starting to remove the old persistent layer for configured imports.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 25 Jan 2019 16:07:09 +0100
parents 74e24ae3205a
children ea0b62b7656b
line wrap: on
line diff
--- a/pkg/models/importbase.go	Fri Jan 25 14:33:03 2019 +0100
+++ b/pkg/models/importbase.go	Fri Jan 25 16:07:09 2019 +0100
@@ -83,6 +83,34 @@
 	return nil
 }
 
+func (et *EmailType) MarshalAttributes(attrs common.Attributes) error {
+	if et.Email {
+		attrs.SetBool("email", et.Email)
+	}
+	return nil
+}
+
+func (et *EmailType) UnmarshalAttributes(attrs common.Attributes) error {
+	et.Email = attrs.Bool("email")
+	return nil
+}
+
+func (qct *QueueConfigurationType) MarshalAttributes(attrs common.Attributes) error {
+	if err := qct.EmailType.MarshalAttributes(attrs); err != nil {
+		return err
+	}
+	if qct.Trys != nil {
+		attrs.SetInt("trys", *qct.Trys)
+	}
+	if qct.WaitRetry != nil {
+		attrs.SetDuration("wait-retry", *qct.WaitRetry)
+	}
+	if qct.Due != nil {
+		attrs.SetTime("due", *qct.Due)
+	}
+	return nil
+}
+
 func (ut *URLType) MarshalAttributes(attrs common.Attributes) error {
 	attrs.Set("url", ut.URL)
 	if ut.Insecure {