hiboot: hidevops.io/hiboot/pkg/utils/replacer Index | Files

package replacer

import "hidevops.io/hiboot/pkg/utils/replacer"

Package replacer provides utilities that replace the reference and environment variables with its value


Package Files



const (
    // EmptyString is the empty string ""
    EmptyString = ""


var (
    // ErrNilPointer nil pointer error
    ErrNilPointer = errors.New("nil pointer error")
    // ErrInvalidObject invalid object error
    ErrInvalidObject = errors.New("invalid object")

func GetFieldValue Uses

func GetFieldValue(f interface{}, name string) (retVal reflect.Value, err error)

GetFieldValue get filed value in reflected format

func GetMatches Uses

func GetMatches(source string) [][]string

GetMatches get compiled matches

func GetReferenceValue Uses

func GetReferenceValue(object interface{}, name string) (reflect.Value, error)

GetReferenceValue get the value of the reference, e.g. ${app.name}

func ParseReferences Uses

func ParseReferences(st interface{}, varName []string) interface{}

ParseReferences parse the variable references

func ParseVariables Uses

func ParseVariables(src string, re *regexp.Regexp) [][]string

ParseVariables parse reference and env variables

func Replace Uses

func Replace(to interface{}, root interface{}) error

Replace given env and reference variables inside specific struct

func ReplaceMap Uses

func ReplaceMap(m map[string]interface{}, root interface{}) error

ReplaceMap replace references and env variables

func ReplaceStringVariables Uses

func ReplaceStringVariables(source string, t interface{}) interface{}

ReplaceStringVariables replace reference and env variables

Package replacer imports 7 packages (graph) and is imported by 4 packages. Updated 2019-05-20. Refresh now. Tools for package owners.