Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToString ¶
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 ¶
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:
- if tag type is specified, which is optional, "key" will be replaced by the tag name
- 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.
Click to show internal directories.
Click to hide internal directories.