Provide Marshaler interface (#151)
The toml.Marhshaler interface allows marshalling custom objects implementing the interface. Design based off json.Marshaler.
This commit is contained in:
committed by
Thomas Pelletier
parent
e32a2e0474
commit
fe206efb84
@@ -52,6 +52,9 @@ func tomlValueStringRepresentation(v interface{}) (string, error) {
|
||||
return strconv.FormatFloat(value, 'f', -1, 32), nil
|
||||
case string:
|
||||
return "\"" + encodeTomlString(value) + "\"", nil
|
||||
case []byte:
|
||||
b, _ := v.([]byte)
|
||||
return tomlValueStringRepresentation(string(b))
|
||||
case bool:
|
||||
if value {
|
||||
return "true", nil
|
||||
|
||||
Reference in New Issue
Block a user