Shortened configuration struct names from JobSearchConfig to JSC since they are distinguished by being in the config package anyway
This commit is contained in:
1 parent
5ec4b65b91
commit
be4770cbab
11 files changed
+71
-67
No files matched your search
@@ -8,35 +8,35 @@ import (
|
||||
// JSCKSources is the sources section's configuration key.
|
||||
const JSCKSources string = "sources"
|
||||
|
||||
// JobSearchConfigSources configures each source of opportunities, one field
|
||||
// JSCSources configures each source of opportunities, one field
|
||||
// per source. Each field's cfg tag must match the section's JSCK* constant.
|
||||
type JobSearchConfigSources struct {
|
||||
FindATender JobSearchConfigSourceFindATender `cfg:"find_a_tender"`
|
||||
FTSMock JobSearchConfigSourceFTSMock `cfg:"fts_mock"`
|
||||
Sleeper JobSearchConfigSourceSleeper `cfg:"sleeper"`
|
||||
type JSCSources struct {
|
||||
FindATender JSCSourceFindATender `cfg:"find_a_tender"`
|
||||
FTSMock JSCSourceFTSMock `cfg:"fts_mock"`
|
||||
Sleeper JSCSourceSleeper `cfg:"sleeper"`
|
||||
}
|
||||
|
||||
// ---------- Section methods (see Section) ----------
|
||||
|
||||
func (c JobSearchConfigSources) Map() map[string]any { return mapOf(c) }
|
||||
func (c JSCSources) Map() map[string]any { return mapOf(c) }
|
||||
|
||||
func (c JobSearchConfigSources) Flatten() map[string]any {
|
||||
func (c JSCSources) Flatten() map[string]any {
|
||||
return flattenOf(JSCKSources, c)
|
||||
}
|
||||
|
||||
func (c JobSearchConfigSources) TypeOf(key string) (reflect.Kind, error) {
|
||||
func (c JSCSources) TypeOf(key string) (reflect.Kind, error) {
|
||||
return typeOf(c, key)
|
||||
}
|
||||
|
||||
func (c JobSearchConfigSources) ValueOf(key string) (any, error) {
|
||||
func (c JSCSources) ValueOf(key string) (any, error) {
|
||||
return valueOf(c, key)
|
||||
}
|
||||
|
||||
func (c *JobSearchConfigSources) SetValue(key string, value any) error {
|
||||
func (c *JSCSources) SetValue(key string, value any) error {
|
||||
return setValue(c, key, value)
|
||||
}
|
||||
|
||||
// ---------- Generic Source definition ----------
|
||||
// ========== Generic source ==========
|
||||
|
||||
// JobSearchConfigSource holds the settings every source has, and is embedded
|
||||
// in each source's section. Interval is how often an enabled source fetches.
|
||||
@@ -45,7 +45,7 @@ type JobSearchConfigSource struct {
|
||||
Interval time.Duration `cfg:"interval" default:"10m"`
|
||||
}
|
||||
|
||||
// ---------- Section methods for Source (see Section) ----------
|
||||
// ---------- Section methods (see Section) ----------
|
||||
|
||||
func (c JobSearchConfigSource) Map() map[string]any { return mapOf(c) }
|
||||
|
||||
|
||||
Reference in new issue
Block a user