proptagconfig

package module
v0.0.0-...-68839a6 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2016 License: MIT Imports: 5 Imported by: 0

README

proptagconfig

TagValueGetter implementation for retrieving values from java properties files with the heavy lifting done by https://github.com/magiconair/properties

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedSetType = errors.New("Received an unsupported type to set")

Functions

func PopulatePropertiesFromStruct

func PopulatePropertiesFromStruct(value interface{}) (*properties.Properties, error)

PopulatePropertiesFromStruct is used to create *properties.Properties based off of fields/data within a struct.

Types

type PropTagConfig

type PropTagConfig struct {
	*properties.Properties
}

PropTagConfig implements the TagValueGetter to allow for populating a struct via "prop" struct tagconfig. It also implements TagValueSetter which allows for the struct to populate properties, which is basically the inverse of the TagValueGetter interface.

func (*PropTagConfig) Get

func (pv *PropTagConfig) Get(key string, _ reflect.StructField) string

func (*PropTagConfig) Set

func (pv *PropTagConfig) Set(key string, value interface{}, _ reflect.StructField) error

Set is used to set properties based on values provided by the struct. For this iteration, it only supports a couple of major types, but if there's a need for this to grow, we can make this more sophisticated.

func (*PropTagConfig) TagName

func (pv *PropTagConfig) TagName() string

Jump to

Keyboard shortcuts

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