aboutsummaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-03-06 20:29:45 -0500
committerXe Iaso <me@xeiaso.net>2024-03-06 20:29:45 -0500
commitf319c1fa6b0a672e5373c4648275d643b4900fa2 (patch)
treedae2205b29cfd4faea4c639e860f03e3b774dc53 /proto
parentffaea423b670030978c4ec0c2efa72a3bc8386c1 (diff)
downloadx-f319c1fa6b0a672e5373c4648275d643b4900fa2.tar.xz
x-f319c1fa6b0a672e5373c4648275d643b4900fa2.zip
proto/sanguisuga: add valid.Interface instances
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'proto')
-rw-r--r--proto/sanguisuga/sanguisuga.valid.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/proto/sanguisuga/sanguisuga.valid.go b/proto/sanguisuga/sanguisuga.valid.go
new file mode 100644
index 0000000..0b7c326
--- /dev/null
+++ b/proto/sanguisuga/sanguisuga.valid.go
@@ -0,0 +1,28 @@
+package sanguisuga
+
+import (
+ "errors"
+ "fmt"
+)
+
+func (s *Show) Valid() error {
+ var errs []error
+
+ if s.Title == "" {
+ errs = append(errs, errors.New("title is empty"))
+ }
+
+ if s.DiskPath == "" {
+ errs = append(errs, errors.New("disk path is empty"))
+ }
+
+ if s.Quality != "1080p" {
+ errs = append(errs, errors.New("quality is not 1080p"))
+ }
+
+ if len(errs) == 0 {
+ return nil
+ }
+
+ return fmt.Errorf("show is invalid: %w", errors.Join(errs...))
+}