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 ¶
type ErrMessage ¶ added in v0.2.2
func NewErrMessage ¶ added in v0.2.2
func NewErrMessage(header string, errCode int, raw string) *ErrMessage
NewErrMessage is an exported alias of newErrMessage() function
func (*ErrMessage) Clone ¶ added in v0.2.2
func (e *ErrMessage) Clone() *ErrMessage
Clone returns a new *ErrMessage with same member variables
func (*ErrMessage) Code ¶ added in v0.2.2
func (e *ErrMessage) Code() string
Code returns combined Header and ErrCode string
func (*ErrMessage) Error ¶ added in v0.2.2
func (e *ErrMessage) Error() string
Error is an implementation fo Error interface
func (*ErrMessage) ErrorOrNil ¶ added in v0.2.2
func (e *ErrMessage) ErrorOrNil() error
ErrorOrNil returns an error interface if both Header and ErrCode are not zero value, otherwise, returns nil. This function is useful at the end of accumulation to make sure that the value returned represents the existence of errors
func (*ErrMessage) Renew ¶ added in v0.2.2
func (e *ErrMessage) Renew(ins ...interface{}) *ErrMessage
Renew returns a new *ErrMessage and specify with given input
func (*ErrMessage) Specify ¶ added in v0.2.2
func (e *ErrMessage) Specify(ins ...interface{})
Specify specifies place holders with given data
func (*ErrMessage) String ¶ added in v0.2.20
func (e *ErrMessage) String() string
String is an alias of Error()