diff options
| author | Xe Iaso <me@xeiaso.net> | 2024-03-06 20:29:45 -0500 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2024-03-06 20:29:45 -0500 |
| commit | f319c1fa6b0a672e5373c4648275d643b4900fa2 (patch) | |
| tree | dae2205b29cfd4faea4c639e860f03e3b774dc53 /proto | |
| parent | ffaea423b670030978c4ec0c2efa72a3bc8386c1 (diff) | |
| download | x-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.go | 28 |
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...)) +} |
