config

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: Apache-2.0 Imports: 7 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToString

func ConvertToString(in interface{}, tagType ...string) (s string, err error)

ConvertToString convert struct to string

func ConvertToStringWithTitle

func ConvertToStringWithTitle(in interface{}, title string, tagType ...string) (s string, err error)

ConvertToStringWithTitle convert struct to string with given title

func WriteToBuffer

func WriteToBuffer(in interface{}, buffer *bytes.Buffer, tagType ...string) (err error)

WriteToBuffer loops each member of given input struct recursively, converts member variable names and concerning values to "key = value" string, and then write the string into buffer, it follows some rules:

  1. if tag type is specified, which is optional, "key" will be replaced by the tag name
  2. toml and ini type config files requires each key should has a value(but could be empty), but some toml/ini like config files(for example: my.cnf) allows variables are only keys instead of key value pairs, (for example: skip-name-resolve), in this case, you can specify constant.DefaultRandomString or constant.DefaultRandomInt to those keys not having values, therefore when this function find out those constant values, it will convert to key string ignore the value and also the equal mark

Types

This section is empty.

Jump to

Keyboard shortcuts

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