Skip to content

Commit

Permalink
feat: write json and string methods for producer and consumer configs (
Browse files Browse the repository at this point in the history
  • Loading branch information
oktaykcr committed Aug 24, 2024
1 parent 5e312be commit a55af9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions producer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type WriterConfig struct {
AllowAutoTopicCreation bool
}

func (cfg WriterConfig) Json() string {
func (cfg WriterConfig) JSON() string {
return fmt.Sprintf(`{"Brokers": ["%s"], "Balancer": %q, "Compression": %q}`,
strings.Join(cfg.Brokers, "\", \""), GetBalancerString(cfg.Balancer), cfg.Compression.String())
}
Expand Down Expand Up @@ -66,7 +66,7 @@ func (cfg *ProducerConfig) JSON() string {
return "{}"
}
return fmt.Sprintf(`{"Writer": %s, "ClientID": %q, "DistributedTracingEnabled": %t, "SASL": %s, "TLS": %s}`,
cfg.Writer.Json(), cfg.ClientID, cfg.DistributedTracingEnabled, cfg.SASL.JSON(), cfg.TLS.JSON())
cfg.Writer.JSON(), cfg.ClientID, cfg.DistributedTracingEnabled, cfg.SASL.JSON(), cfg.TLS.JSON())
}

func (cfg *ProducerConfig) JSONPretty() string {
Expand Down

0 comments on commit a55af9d

Please sign in to comment.