about summary refs log tree commit diff stats
path: root/internal/importer/source-type.go
diff options
context:
space:
mode:
authorAlan Pearce2024-05-13 15:07:00 +0200
committerAlan Pearce2024-05-13 15:07:00 +0200
commit37deedc9b1da92571548c920721984d545269eb4 (patch)
tree4e5eae6e7bc95bf70d2ec954e042e4193b13137a /internal/importer/source-type.go
parentf700a3284ecc88bb2af1df5f0c8d242290a549cc (diff)
downloadsearchix-37deedc9b1da92571548c920721984d545269eb4.tar.lz
searchix-37deedc9b1da92571548c920721984d545269eb4.tar.zst
searchix-37deedc9b1da92571548c920721984d545269eb4.zip
refactor: move Source/Repository types to config package
Diffstat (limited to 'internal/importer/source-type.go')
-rw-r--r--internal/importer/source-type.go60
1 files changed, 0 insertions, 60 deletions
diff --git a/internal/importer/source-type.go b/internal/importer/source-type.go
deleted file mode 100644
index 0e9bb73..0000000
--- a/internal/importer/source-type.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package importer
-
-import (
-	"fmt"
-	"time"
-
-	"github.com/stoewer/go-strcase"
-)
-
-type Type int
-
-const (
-	Unknown = iota
-	Channel
-	ChannelNixpkgs
-)
-
-func (f Type) String() string {
-	switch f {
-	case Channel:
-		return "channel"
-	case ChannelNixpkgs:
-		return "channel-nixpkgs"
-	}
-
-	return fmt.Sprintf("Fetcher(%d)", f)
-}
-
-func parseType(name string) (Type, error) {
-	switch strcase.KebabCase(name) {
-	case "channel":
-		return Channel, nil
-	case "channel-nixpkgs":
-		return ChannelNixpkgs, nil
-	default:
-		return Unknown, fmt.Errorf("unsupported fetcher %s", name)
-	}
-}
-
-func (f *Type) UnmarshalText(text []byte) error {
-	var err error
-	*f, err = parseType(string(text))
-
-	return err
-}
-
-type Source struct {
-	Name          string
-	Key           string
-	Enable        bool
-	Type          Type
-	Channel       string
-	URL           string
-	Attribute     string
-	ImportPath    string        `toml:"import-path"`
-	FetchTimeout  time.Duration `toml:"fetch-timeout"`
-	ImportTimeout time.Duration `toml:"import-timeout"`
-	OutputPath    string        `toml:"output-path"`
-	Repo          Repository
-}