Updated example code and readme to help explain encoding issues #34

Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
Dave Shanley
2022-12-03 11:49:57 -05:00
parent 7aa8678d77
commit 0f774a4c4b
2 changed files with 9 additions and 4 deletions

View File

@@ -302,9 +302,11 @@ import (
)
// define an example struct representing a cake
// super important to remember to use hints/meta-data to map properties correctly.
type cake struct {
Candles int
Frosting string
Candles int `yaml:"candles"`
Frosting string `yaml:"frosting"`
Some_Strange_Var_Name string `yaml:"someStrangeVarName"`
}
// define a struct that holds a map of cake pointers.
@@ -340,6 +342,7 @@ func main() {
someCake:
candles: 10
frosting: blue
someStrangeVarName: mapping is required to extract these.
anotherCake:
candles: 1
frosting: green

View File

@@ -546,8 +546,9 @@ func ExampleNewDocument_unpacking_extensions() {
// define an example struct representing a cake
type cake struct {
Candles int
Frosting string
Candles int `yaml:"candles"`
Frosting string `yaml:"frosting"`
Some_Strange_Var_Name string `yaml:"someStrangeVarName"`
}
// define a struct that holds a map of cake pointers.
@@ -580,6 +581,7 @@ components:
someCake:
candles: 10
frosting: blue
someStrangeVarName: something
anotherCake:
candles: 1
frosting: green