Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(gateway): update nop and influx ingester
- Loading branch information
Showing
8 changed files
with
97 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package influx | ||
|
||
import ( | ||
"log/slog" | ||
|
||
"github.com/InfluxCommunity/influxdb3-go/influxdb3" | ||
) | ||
|
||
type Options struct { | ||
client *influxdb3.Client | ||
database string | ||
organization string | ||
logger *slog.Logger | ||
} | ||
|
||
type Option func(*Options) | ||
|
||
// WithClient sets the InfluxDB client in Options | ||
func WithClient(client *influxdb3.Client) Option { | ||
return func(o *Options) { | ||
o.client = client | ||
} | ||
} | ||
|
||
// WithDatabase sets the database in Options | ||
func WithDatabase(database string) Option { | ||
return func(o *Options) { | ||
o.database = database | ||
} | ||
} | ||
|
||
// WithOrganization sets the organization in Options | ||
func WithOrganization(organization string) Option { | ||
return func(o *Options) { | ||
o.organization = organization | ||
} | ||
} | ||
|
||
// WithLogger sets the logger in Options | ||
func WithLogger(logger *slog.Logger) Option { | ||
return func(o *Options) { | ||
o.logger = logger | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package ingester | ||
|
||
type NopIngester struct{} | ||
|
||
func (n *NopIngester) Get(key string) ([]map[string]interface{}, error) { | ||
return nil, nil | ||
} | ||
func (n *NopIngester) Ingest(data map[string]interface{}, key string) {} | ||
func (n *NopIngester) Close() error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters