propkit

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package propkit is used to interpret AppConfig/Properties configuration units.

Index

Constants

View Source
const (
	ResourceTypeNoSchema = api.ResourceType("NoSchema")
	ResourceNameNoName   = api.ResourceName("NoName")
	ConfigSchemaPath     = api.ResolvedPath("configHub.configSchema")
	ConfigNamePath       = api.ResolvedPath("configHub.configName")
)

Variables

View Source
var PropertiesResourceProvider = &PropertiesResourceProviderType{}

PropertiesResourceProvider implements the ResourceProvider interface for AppConfig/Properties.

Functions

This section is empty.

Types

type PropertiesParser

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

PropertiesParser handles parsing of Java Properties files

func NewPropertiesParser

func NewPropertiesParser() *PropertiesParser

NewPropertiesParser creates a new parser instance

func (*PropertiesParser) GetProperties

func (p *PropertiesParser) GetProperties() map[string]string

GetProperties returns the flat properties map

func (*PropertiesParser) ParseProperties

func (p *PropertiesParser) ParseProperties(propertiesData []byte) error

ParseProperties reads and parses Java Properties from byte slice

func (*PropertiesParser) ToNestedMap

func (p *PropertiesParser) ToNestedMap() map[string]interface{}

ToNestedMap converts flat properties to nested map structure

type PropertiesResourceProviderType

type PropertiesResourceProviderType struct{}

func (*PropertiesResourceProviderType) ContextPath

func (*PropertiesResourceProviderType) ContextPath(contextField string) string

func (*PropertiesResourceProviderType) DataType

func (*PropertiesResourceProviderType) DefaultResourceCategory

func (*PropertiesResourceProviderType) DefaultResourceCategory() api.ResourceCategory

DefaultResourceCategory returns the default resource category to asssume, which is AppConfig in this case.

func (*PropertiesResourceProviderType) GetPathRegistry

func (*PropertiesResourceProviderType) NameSeparator

func (*PropertiesResourceProviderType) NameSeparator() string

func (*PropertiesResourceProviderType) NativeToYAML

func (*PropertiesResourceProviderType) NativeToYAML(data []byte) ([]byte, error)

func (*PropertiesResourceProviderType) NormalizeName

func (*PropertiesResourceProviderType) NormalizeName(name string) string

func (*PropertiesResourceProviderType) RemoveScopeFromResourceName

func (*PropertiesResourceProviderType) RemoveScopeFromResourceName(resourceName api.ResourceName) api.ResourceName

func (*PropertiesResourceProviderType) ResourceAndCategoryTypeMaps

func (*PropertiesResourceProviderType) ResourceAndCategoryTypeMaps(docs gaby.Container) (resourceMap yamlkit.ResourceNameToCategoryTypesMap, categoryTypeMap yamlkit.ResourceCategoryTypeToNamesMap, err error)

ResourceAndCategoryTypeMaps returns maps of all resources in the provided list of parsed YAML documents, from from names to categories+types and categories+types to names.

func (*PropertiesResourceProviderType) ResourceCategoryGetter

func (*PropertiesResourceProviderType) ResourceCategoryGetter(doc *gaby.YamlDoc) (api.ResourceCategory, error)

ResourceCategoryGetter just returns ResourceCategoryAppConfig for Properties documents.

func (*PropertiesResourceProviderType) ResourceNameGetter

func (*PropertiesResourceProviderType) ResourceNameGetter(doc *gaby.YamlDoc) (api.ResourceName, error)

ResourceNameGetter extracts the property configHub.configName, and returns NoName if not present.

func (*PropertiesResourceProviderType) ResourceTypeGetter

func (*PropertiesResourceProviderType) ResourceTypeGetter(doc *gaby.YamlDoc) (api.ResourceType, error)

ResourceTypeGetter extracts the property configHub.configSchema, and returns NoSchema if not present.

func (*PropertiesResourceProviderType) ResourceTypesAreSimilar

func (*PropertiesResourceProviderType) ResourceTypesAreSimilar(resourceTypeA, resourceTypeB api.ResourceType) bool

func (*PropertiesResourceProviderType) ScopelessResourceNamePath

func (*PropertiesResourceProviderType) ScopelessResourceNamePath() api.ResolvedPath

func (*PropertiesResourceProviderType) SetResourceName

func (*PropertiesResourceProviderType) SetResourceName(doc *gaby.YamlDoc, name string) error

func (*PropertiesResourceProviderType) TypeDescription

func (*PropertiesResourceProviderType) TypeDescription() string

func (*PropertiesResourceProviderType) YAMLToNative

func (*PropertiesResourceProviderType) YAMLToNative(yamlData []byte) ([]byte, error)

ConvertYAMLToProperties is a convenience function for one-shot conversion

type YAMLToPropertiesConverter

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

YAMLToPropertiesConverter handles conversion from YAML to Properties

func NewYAMLToPropertiesConverter

func NewYAMLToPropertiesConverter() *YAMLToPropertiesConverter

NewYAMLToPropertiesConverter creates a new converter instance

func (*YAMLToPropertiesConverter) GetProperties

func (c *YAMLToPropertiesConverter) GetProperties() map[string]string

GetProperties returns the flattened properties map

func (*YAMLToPropertiesConverter) ParseYAML

func (c *YAMLToPropertiesConverter) ParseYAML(yamlData []byte) error

ParseYAML reads and parses YAML from byte slice

func (*YAMLToPropertiesConverter) ParseYAMLFile

func (c *YAMLToPropertiesConverter) ParseYAMLFile(filename string) error

ParseYAMLFile reads and parses a YAML file (convenience method)

func (*YAMLToPropertiesConverter) ToProperties

func (c *YAMLToPropertiesConverter) ToProperties() ([]byte, error)

ToProperties converts the parsed YAML to Properties format as byte slice

func (*YAMLToPropertiesConverter) WritePropertiesToWriter

func (c *YAMLToPropertiesConverter) WritePropertiesToWriter(writer *bufio.Writer) error

WritePropertiesToWriter writes properties to any writer (for stdout output)

Jump to

Keyboard shortcuts

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