Skip to content

Commit

Permalink
fix: use pointer for struct field so the default value from unmarshal…
Browse files Browse the repository at this point in the history
… is nil (streamnative/pulsar-admin-go#36)

Use pointer for struct field so the default value from unmarshal is nil

Co-authored-by: Neng Lu <[email protected]>
  • Loading branch information
2 people authored and tisonkun committed Aug 15, 2023
1 parent c1b9f76 commit 08f1894
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pulsaradmin/pkg/utils/consumer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ type ConsumerConfig struct {
ReceiverQueueSize int `json:"receiverQueueSize,omitempty" yaml:"receiverQueueSize"`
SchemaProperties map[string]string `json:"schemaProperties,omitempty" yaml:"schemaProperties"`
ConsumerProperties map[string]string `json:"consumerProperties,omitempty" yaml:"consumerProperties"`
CryptoConfig CryptoConfig `json:"cryptoConfig,omitempty" yaml:"cryptoConfig"`
CryptoConfig *CryptoConfig `json:"cryptoConfig,omitempty" yaml:"cryptoConfig"`
PoolMessages bool `json:"poolMessages,omitempty" yaml:"poolMessages"`
}
1 change: 1 addition & 0 deletions pulsaradmin/pkg/utils/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ type SinkData struct {
MaxMessageRetries int `json:"maxMessageRetries,omitempty"`
DeadLetterTopic string `json:"deadLetterTopic,omitempty"`
ProcessingGuarantees string `json:"processingGuarantees,omitempty"`
RetainKeyOrdering bool `json:"retainKeyOrdering,omitempty"`
Archive string `json:"archive,omitempty"`
ClassName string `json:"className,omitempty"`
SinkConfigFile string `json:"sinkConfigFile,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pulsaradmin/pkg/utils/function_confg.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type FunctionConfig struct {

Output string `json:"output,omitempty" yaml:"output"`

ProducerConfig ProducerConfig `json:"producerConfig,omitempty" yaml:"producerConfig"`
ProducerConfig *ProducerConfig `json:"producerConfig,omitempty" yaml:"producerConfig"`
CustomSchemaOutputs map[string]string `json:"customSchemaOutputs,omitempty" yaml:"customSchemaOutputs"`

OutputSerdeClassName string `json:"outputSerdeClassName,omitempty" yaml:"outputSerdeClassName"`
Expand Down
8 changes: 4 additions & 4 deletions pulsaradmin/pkg/utils/producer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ type ProducerConfig struct {
//nolint
MaxPendingMessagesAcrossPartitions int `json:"maxPendingMessagesAcrossPartitions" yaml:"maxPendingMessagesAcrossPartitions"`

UseThreadLocalProducers bool `json:"useThreadLocalProducers" yaml:"useThreadLocalProducers"`
CryptoConfig CryptoConfig `json:"cryptoConfig" yaml:"cryptoConfig"`
BatchBuilder string `json:"batchBuilder" yaml:"batchBuilder"`
CompressionType string `json:"compressionType" yaml:"compressionType"`
UseThreadLocalProducers bool `json:"useThreadLocalProducers" yaml:"useThreadLocalProducers"`
CryptoConfig *CryptoConfig `json:"cryptoConfig" yaml:"cryptoConfig"`
BatchBuilder string `json:"batchBuilder" yaml:"batchBuilder"`
CompressionType string `json:"compressionType" yaml:"compressionType"`
}
6 changes: 3 additions & 3 deletions pulsaradmin/pkg/utils/source_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type SourceConfig struct {
Name string `json:"name,omitempty" yaml:"name"`
ClassName string `json:"className,omitempty" yaml:"className"`

ProducerConfig ProducerConfig `json:"producerConfig,omitempty" yaml:"producerConfig"`
ProducerConfig *ProducerConfig `json:"producerConfig,omitempty" yaml:"producerConfig"`

TopicName string `json:"topicName,omitempty" yaml:"topicName"`
SerdeClassName string `json:"serdeClassName,omitempty" yaml:"serdeClassName"`
Expand All @@ -45,6 +45,6 @@ type SourceConfig struct {

CustomRuntimeOptions string `json:"customRuntimeOptions,omitempty" yaml:"customRuntimeOptions"`

BatchSourceConfig BatchSourceConfig `json:"batchSourceConfig,omitempty" yaml:"batchSourceConfig"`
BatchBuilder string `json:"batchBuilder,omitempty" yaml:"batchBuilder"`
BatchSourceConfig *BatchSourceConfig `json:"batchSourceConfig,omitempty" yaml:"batchSourceConfig"`
BatchBuilder string `json:"batchBuilder,omitempty" yaml:"batchBuilder"`
}

0 comments on commit 08f1894

Please sign in to comment.