Skip to content

Commit 4c18210

Browse files
authored
chore: add struct tags and update docs (#477)
1 parent 905cc68 commit 4c18210

32 files changed

Lines changed: 89 additions & 93 deletions

File tree

plugins/extractors/bigquery/bigquery.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,25 @@ var summary string
3434

3535
// Config holds the set of configuration for the bigquery extractor
3636
type Config struct {
37-
ProjectID string `mapstructure:"project_id" validate:"required"`
37+
ProjectID string `json:"project_id" yaml:"project_id" mapstructure:"project_id" validate:"required"`
3838
// ServiceAccountBase64 takes precedence over ServiceAccountJSON field
39-
ServiceAccountBase64 string `mapstructure:"service_account_base64"`
40-
ServiceAccountJSON string `mapstructure:"service_account_json"`
41-
MaxPageSize int `mapstructure:"max_page_size"`
42-
TablePattern string `mapstructure:"table_pattern"`
43-
Exclude Exclude `mapstructure:"exclude"`
44-
IncludeColumnProfile bool `mapstructure:"include_column_profile"`
45-
MaxPreviewRows int `mapstructure:"max_preview_rows" default:"30"`
46-
IsCollectTableUsage bool `mapstructure:"collect_table_usage" default:"false"`
47-
UsagePeriodInDay int64 `mapstructure:"usage_period_in_day" default:"7"`
48-
UsageProjectIDs []string `mapstructure:"usage_project_ids"`
39+
ServiceAccountBase64 string `json:"service_account_base64" yaml:"service_account_base64" mapstructure:"service_account_base64"`
40+
ServiceAccountJSON string `json:"service_account_json" yaml:"service_account_json" mapstructure:"service_account_json"`
41+
MaxPageSize int `json:"max_page_size" yaml:"max_page_size" mapstructure:"max_page_size"`
42+
TablePattern string `json:"table_pattern" yaml:"table_pattern" mapstructure:"table_pattern"`
43+
Exclude Exclude `json:"exclude" yaml:"exclude" mapstructure:"exclude"`
44+
IncludeColumnProfile bool `json:"include_column_profile" yaml:"include_column_profile" mapstructure:"include_column_profile"`
45+
MaxPreviewRows int `json:"max_preview_rows" yaml:"max_preview_rows" mapstructure:"max_preview_rows" default:"30"`
46+
IsCollectTableUsage bool `json:"collect_table_usage" yaml:"collect_table_usage" mapstructure:"collect_table_usage" default:"false"`
47+
UsagePeriodInDay int64 `json:"usage_period_in_day" yaml:"usage_period_in_day" mapstructure:"usage_period_in_day" default:"7"`
48+
UsageProjectIDs []string `json:"usage_project_ids" yaml:"usage_project_ids" mapstructure:"usage_project_ids"`
4949
}
5050

5151
type Exclude struct {
5252
// list of datasetIDs
53-
Datasets []string `mapstructure:"datasets"`
53+
Datasets []string `json:"datasets" yaml:"datasets" mapstructure:"datasets"`
5454
// list of tableNames in format - datasetID.tableID
55-
Tables []string `mapstructure:"tables"`
55+
Tables []string `json:"tables" yaml:"tables" mapstructure:"tables"`
5656
}
5757

5858
const (

plugins/extractors/bigtable/bigtable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727

2828
// Config holds the configurations for the bigtable extractor
2929
type Config struct {
30-
ProjectID string `mapstructure:"project_id" validate:"required"`
30+
ProjectID string `json:"project_id" yaml:"project_id" mapstructure:"project_id" validate:"required"`
3131
}
3232

3333
var info = plugins.Info{

plugins/extractors/caramlstore/caramlstore.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ var summary string
2929

3030
// Config holds the set of configuration for the CaraML Store extractor
3131
type Config struct {
32-
URL string `mapstructure:"url" validate:"required"`
33-
MaxSizeInMB int `mapstructure:"max_size_in_mb"`
34-
RequestTimeout time.Duration `mapstructure:"request_timeout" validate:"min=1ms" default:"10s"`
32+
URL string `json:"url" yaml:"url" mapstructure:"url" validate:"required"`
33+
MaxSizeInMB int `json:"max_size_in_mb" yaml:"max_size_in_mb" mapstructure:"max_size_in_mb"`
34+
RequestTimeout time.Duration `json:"request_timeout" yaml:"request_timeout" mapstructure:"request_timeout" validate:"min=1ms" default:"10s"`
3535
}
3636

3737
var sampleConfig = `url: caraml-store.com:80`

plugins/extractors/cassandra/cassandra.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ const (
3737

3838
// Config holds the set of configuration for the cassandra extractor
3939
type Config struct {
40-
UserID string `mapstructure:"user_id" validate:"required"`
41-
Password string `mapstructure:"password" validate:"required"`
42-
Host string `mapstructure:"host" validate:"required"`
43-
Port int `mapstructure:"port" validate:"required"`
40+
UserID string `json:"user_id" yaml:"user_id" mapstructure:"user_id" validate:"required"`
41+
Password string `json:"password" yaml:"password" mapstructure:"password" validate:"required"`
42+
Host string `json:"host" yaml:"host" mapstructure:"host" validate:"required"`
43+
Port int `json:"port" yaml:"port" mapstructure:"port" validate:"required"`
4444
}
4545

4646
var sampleConfig = `

plugins/extractors/clickhouse/clickhouse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var summary string
2222

2323
// Config holds the connection URL for the extractor
2424
type Config struct {
25-
ConnectionURL string `mapstructure:"connection_url" validate:"required"`
25+
ConnectionURL string `json:"connection_url" yaml:"connection_url" mapstructure:"connection_url" validate:"required"`
2626
}
2727

2828
var sampleConfig = `connection_url: "tcp://localhost:3306?username=admin&password=pass123&debug=true"`

plugins/extractors/couchdb/couchdb.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var defaultDBList = []string{
2727

2828
// Config holds the connection URL for the extractor
2929
type Config struct {
30-
ConnectionURL string `mapstructure:"connection_url" validate:"required"`
30+
ConnectionURL string `json:"connection_url" yaml:"connection_url" mapstructure:"connection_url" validate:"required"`
3131
}
3232

3333
var sampleConfig = `connection_url: http://admin:pass123@localhost:3306/`
@@ -139,10 +139,10 @@ func (e *Extractor) processTable(ctx context.Context, dbName string, docID strin
139139
// push table to channel
140140
e.emit(models.NewRecord(&v1beta2.Asset{
141141
Urn: models.NewURN("couchdb", e.UrnScope, "table", fmt.Sprintf("%s.%s", dbName, docID)),
142-
Name: docID,
143-
Type: "table",
142+
Name: docID,
143+
Type: "table",
144144
Service: "couchdb",
145-
Data: table,
145+
Data: table,
146146
}))
147147

148148
return

plugins/extractors/elastic/elastic.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
var summary string
2323

2424
type Config struct {
25-
User string `mapstructure:"user"`
26-
Password string `mapstructure:"password"`
27-
Host string `mapstructure:"host" validate:"required"`
25+
User string `json:"user" yaml:"user" mapstructure:"user"`
26+
Password string `json:"password" yaml:"password" mapstructure:"password"`
27+
Host string `json:"host" yaml:"host" mapstructure:"host" validate:"required"`
2828
}
2929

3030
var sampleConfig = `

plugins/extractors/gcs/gcs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ var summary string
2525

2626
// Config holds the set of configuration for the extractor
2727
type Config struct {
28-
ProjectID string `mapstructure:"project_id" validate:"required"`
29-
ServiceAccountJSON string `mapstructure:"service_account_json"`
30-
ExtractBlob bool `mapstructure:"extract_blob"`
28+
ProjectID string `json:"project_id" yaml:"project_id" mapstructure:"project_id" validate:"required"`
29+
ServiceAccountJSON string `json:"service_account_json" yaml:"service_account_json" mapstructure:"service_account_json"`
30+
ExtractBlob bool `json:"extract_blob" yaml:"extract_blob" mapstructure:"extract_blob"`
3131
}
3232

3333
var sampleConfig = `

plugins/extractors/github/github.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var summary string
2121

2222
// Config holds the set of configuration for the extractor
2323
type Config struct {
24-
Org string `mapstructure:"org" validate:"required"`
25-
Token string `mapstructure:"token" validate:"required"`
24+
Org string `json:"org" yaml:"org" mapstructure:"org" validate:"required"`
25+
Token string `json:"token" yaml:"token" mapstructure:"token" validate:"required"`
2626
}
2727

2828
var sampleConfig = `
@@ -96,8 +96,8 @@ func (e *Extractor) Extract(ctx context.Context, emit plugins.Emit) (err error)
9696
emit(models.NewRecord(&v1beta2.Asset{
9797
Urn: models.NewURN("github", e.UrnScope, "user", usr.GetNodeID()),
9898
Service: "github",
99-
Type: "user",
100-
Data: u,
99+
Type: "user",
100+
Data: u,
101101
}))
102102
}
103103

plugins/extractors/grafana/grafana.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var summary string
2121

2222
// Config holds the set of configuration for the grafana extractor
2323
type Config struct {
24-
BaseURL string `mapstructure:"base_url" validate:"required"`
25-
APIKey string `mapstructure:"api_key" validate:"required"`
24+
BaseURL string `json:"base_url" yaml:"base_url" mapstructure:"base_url" validate:"required"`
25+
APIKey string `json:"api_key" yaml:"api_key" mapstructure:"api_key" validate:"required"`
2626
}
2727

2828
var sampleConfig = `

0 commit comments

Comments
 (0)