diff options
author | Alan Pearce | 2024-05-12 21:29:01 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-12 21:34:57 +0200 |
commit | f24c5b0a9901cc91967ed83bc4a015bd0b2c3d4d (patch) | |
tree | 4e4e2ceca52ee592e415ce6534227e3cb04a6e48 /internal/importer | |
parent | df77930bef039e4aef024574c60fb64d75287eee (diff) | |
download | searchix-f24c5b0a9901cc91967ed83bc4a015bd0b2c3d4d.tar.lz searchix-f24c5b0a9901cc91967ed83bc4a015bd0b2c3d4d.tar.zst searchix-f24c5b0a9901cc91967ed83bc4a015bd0b2c3d4d.zip |
refactor: move Source type
Diffstat (limited to 'internal/importer')
-rw-r--r-- | internal/importer/importer.go | 15 | ||||
-rw-r--r-- | internal/importer/source-type.go | 16 |
2 files changed, 16 insertions, 15 deletions
diff --git a/internal/importer/importer.go b/internal/importer/importer.go index 30ab2f6..0f7978d 100644 --- a/internal/importer/importer.go +++ b/internal/importer/importer.go @@ -6,23 +6,8 @@ import ( "path" "searchix/internal/search" "sync" - "time" ) -type Source struct { - Name string - Key string - Enable bool - Type Type - Channel 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 -} - type Importer interface { FetchIfNeeded(context.Context) (bool, error) Import(context.Context, *search.WriteIndex) (bool, error) diff --git a/internal/importer/source-type.go b/internal/importer/source-type.go index 5d84547..0e9bb73 100644 --- a/internal/importer/source-type.go +++ b/internal/importer/source-type.go @@ -2,6 +2,7 @@ package importer import ( "fmt" + "time" "github.com/stoewer/go-strcase" ) @@ -42,3 +43,18 @@ func (f *Type) UnmarshalText(text []byte) error { 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 +} |