Skip to content

Commit

Permalink
Use type for encoding
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <[email protected]>
  • Loading branch information
pavolloffay committed Jul 16, 2021
1 parent 49bda9e commit 4c545fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion storage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ package storage

import "time"

type EncodingType string

const (
JsonEncoding EncodingType = "json"
ProtobufEncoding EncodingType = "protobuf"
)

type Configuration struct {
// ClickHouse address e.g. tcp://localhost:9000.
Address string `yaml:"address"`
Expand All @@ -12,5 +19,5 @@ type Configuration struct {
// Batch flush interval. Default is 5s.
BatchFlushInterval time.Duration `yaml:"batch_flush_interval"`
// Encoding either json or protobuf. Default is json.
Encoding string `yaml:"encoding"`
Encoding EncodingType `yaml:"encoding"`
}
2 changes: 1 addition & 1 deletion storage/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewStore(logger hclog.Logger, cfg Configuration, embeddedSQLScripts embed.F
cfg.BatchFlushInterval = defaultBatchDelay
}
if cfg.Encoding == "" {
cfg.Encoding = string(clickhousespanstore.EncodingJSON)
cfg.Encoding = JsonEncoding
}
return &Store{
db: db,
Expand Down

0 comments on commit 4c545fc

Please sign in to comment.