helper

package
v0.2.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneProtoMessage

func CloneProtoMessage(t *testing.T, src proto.Message) proto.Message

CloneProtoMessage creates a deep copy of a protobuf message.

func LoadConfigFromFile

func LoadConfigFromFile(t *testing.T, path string, target any) (runtimeconfig.KConfig, error)

LoadConfigFromFile loads configuration from a file and scans into target.

func LoadConfigFromFileWithViper

func LoadConfigFromFileWithViper(t *testing.T, path string, msg proto.Message)

LoadConfigFromFileWithViper loads a config file into a protobuf message.

func SaveConfigToFileWithViper

func SaveConfigToFileWithViper(t *testing.T, msg proto.Message, path string, formatName string)

SaveConfigToFileWithViper saves a protobuf message to a file in the specified format.

func WithMockDataJSON

func WithMockDataJSON(data map[string]interface{}) options.Option

WithMockDataJSON provides mock data for MockConsulSource, marshaling values to JSON.

func WithMockDataString

func WithMockDataString(data map[string]string, format string) options.Option

WithMockDataString provides mock data for MockConsulSource, allowing specification of the format for string values.

func WithMockDataYAML

func WithMockDataYAML(data map[string]interface{}) options.Option

WithMockDataYAML provides mock data for MockConsulSource, marshaling values to YAML.

Types

type MockConsulSource

type MockConsulSource struct {
	// contains filtered or unexported fields
}

MockConsulSource is a mock implementation of a config source for testing purposes.

func (*MockConsulSource) Load

Load returns the mock data as KeyValue pairs.

func (*MockConsulSource) NewSource

func (m *MockConsulSource) NewSource(config *sourcev1.SourceConfig, opts ...options.Option) (kratosconfig.Source,
	error)

NewSource creates a new instance of MockConsulSource.

func (*MockConsulSource) String

func (m *MockConsulSource) String() string

String returns the name of the mock source.

func (*MockConsulSource) Watch

Watch is not implemented for the mock source.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL