diff options
| author | openai-code-agent[bot] <[email protected]> | 2026-04-28 17:48:08 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-28 17:48:08 +0000 |
| commit | bf3a08f53f060f9ff3503d204f9dc15cee0ff2a5 (patch) | |
| tree | cdc7dc6acdeaca6d5185f1b1824e332bfc982caf /plugin/maxmind/maxmind_country_mmdb_in.go | |
| parent | e25f9fcf96d9971e90c3a5df9087d882e4a997a7 (diff) | |
refactor(maxmind): use functional options for mmdb/csv pluginscodex/refactor-plugins-functional-options
Co-authored-by: Loyalsoldier <[email protected]>
Diffstat (limited to 'plugin/maxmind/maxmind_country_mmdb_in.go')
| -rw-r--r-- | plugin/maxmind/maxmind_country_mmdb_in.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/plugin/maxmind/maxmind_country_mmdb_in.go b/plugin/maxmind/maxmind_country_mmdb_in.go index 1f6d5386..9bf6413e 100644 --- a/plugin/maxmind/maxmind_country_mmdb_in.go +++ b/plugin/maxmind/maxmind_country_mmdb_in.go @@ -18,13 +18,29 @@ const ( func init() { lib.RegisterInputConfigCreator(TypeGeoLite2CountryMMDBIn, func(action lib.Action, data json.RawMessage) (lib.InputConverter, error) { - return newGeoLite2CountryMMDBIn(TypeGeoLite2CountryMMDBIn, DescGeoLite2CountryMMDBIn, action, data) + return NewGeoLite2CountryMMDBInFromBytes(TypeGeoLite2CountryMMDBIn, DescGeoLite2CountryMMDBIn, action, data) }) lib.RegisterInputConverter(TypeGeoLite2CountryMMDBIn, &GeoLite2CountryMMDBIn{ Description: DescGeoLite2CountryMMDBIn, }) } +func NewGeoLite2CountryMMDBIn(iType string, iDesc string, action lib.Action, opts ...lib.InputOption) lib.InputConverter { + g := &GeoLite2CountryMMDBIn{ + Type: iType, + Action: action, + Description: iDesc, + } + + for _, opt := range opts { + if opt != nil { + opt(g) + } + } + + return g +} + type GeoLite2CountryMMDBIn struct { Type string Action lib.Action |
