diff options
author | Alan Pearce | 2024-05-13 15:07:00 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-13 15:07:00 +0200 |
commit | 37deedc9b1da92571548c920721984d545269eb4 (patch) | |
tree | 4e5eae6e7bc95bf70d2ec954e042e4193b13137a /internal/importer/repository.go | |
parent | f700a3284ecc88bb2af1df5f0c8d242290a549cc (diff) | |
download | searchix-37deedc9b1da92571548c920721984d545269eb4.tar.lz searchix-37deedc9b1da92571548c920721984d545269eb4.tar.zst searchix-37deedc9b1da92571548c920721984d545269eb4.zip |
refactor: move Source/Repository types to config package
Diffstat (limited to 'internal/importer/repository.go')
-rw-r--r-- | internal/importer/repository.go | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/internal/importer/repository.go b/internal/importer/repository.go deleted file mode 100644 index 6cfd55e..0000000 --- a/internal/importer/repository.go +++ /dev/null @@ -1,44 +0,0 @@ -package importer - -import ( - "fmt" - "strings" -) - -type RepoType int - -const ( - GitHub = iota + 1 -) - -type Repository struct { - Type string `default:"github"` - Owner string - Repo string - Revision string -} - -func (f RepoType) String() string { - switch f { - case GitHub: - return "github" - default: - return fmt.Sprintf("RepoType(%d)", f) - } -} - -func parseRepoType(name string) (RepoType, error) { - switch strings.ToLower(name) { - case "github": - return GitHub, nil - default: - return Unknown, fmt.Errorf("unsupported repo type %s", name) - } -} - -func (f *RepoType) UnmarshalText(text []byte) error { - var err error - *f, err = parseRepoType(string(text)) - - return err -} |