interfaces

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package interfaces contains methods for copying data between interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateDiff

func CalculateDiff(before interface{}, after interface{}) map[string]string

CalculateDiff calculates the difference between two objects.

func GetAPIFieldNames

func GetAPIFieldNames(input interface{}) []string

GetAPIFieldNames returns the names of all fields of an object with an "api" tag.

func GetFieldNames

func GetFieldNames(input interface{}) []string

GetFieldNames returns the names of all fields of an object.

func GetFieldValue

func GetFieldValue(value interface{}, fieldName string) interface{}

GetFieldValue returns the value of a named field.

func GetTagFieldNames

func GetTagFieldNames(input interface{}, tag string) []string

GetTagFieldNames returns the names of all fields of an object.

func GetTagValue

func GetTagValue(tags string, targetTagName string) (tagValue string, exists bool, err error)

GetTagValue returns whether the tag exists. If so, its value.

func Inherit

func Inherit(output interface{}, ancestors []interface{}) error

Inherit inherits values from each ancestor if the output values are their defaults.

func InheritWithTag

func InheritWithTag(output interface{}, ancestors []interface{}, tagName string) error

InheritWithTag inherits values from each ancestor if the output values are their defaults, only if the tag exists.

func InjectVariables

func InjectVariables(input string, variables map[string]interface{}) (interface{}, error)

InjectVariables injects input variables into a formatted string.

func Overwrite

func Overwrite(output interface{}, ancestors []interface{}) error

Overwrite overwrites values in output using values from each ancestor. Equivalent to Inherit without the default checks.

func OverwriteWithTag

func OverwriteWithTag(output interface{}, ancestors []interface{}, tagName string) error

OverwriteWithTag inherits values from each ancestor if the output values are not their defaults, only if the tag exists. Equivalent to InheritWithTag without the default checks.

func ParseTypedValue

func ParseTypedValue(dataString string) reflect.Value

ParseTypedValue attempts to parse the underlying type of a string.

func SetEnvFieldValues

func SetEnvFieldValues(output interface{}) error

SetEnvFieldValues sets field values based on environment variables.

func SetQueryFields

func SetQueryFields(input interface{}, queryValues map[string]string, allValues *bytes.Buffer) error

SetQueryFields maps string versions of each field into queryValues and concatenates all values into allValuesBuffer.

func Sprint

func Sprint(input interface{}) string

Sprint returns fmt.Sprint() unless the input is nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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