-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(backup/source/dummy): Add DummySource (for devel/testing purposes)
- Loading branch information
1 parent
97cbb52
commit 6f298ed
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package dummy | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
|
||
"github.com/sikalabs/tergum/backup_output" | ||
) | ||
|
||
type DummySource struct { | ||
Content string `yaml:"Content"` | ||
} | ||
|
||
func (s DummySource) Validate() error { | ||
if s.Content == "" { | ||
return fmt.Errorf("DummySource need to have a Content") | ||
} | ||
return nil | ||
} | ||
|
||
func (s DummySource) Backup() (backup_output.BackupOutput, error) { | ||
out := bytes.NewReader([]byte(s.Content)) | ||
return backup_output.BackupOutput{Data: out}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters