-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some clearification to the README file
- Loading branch information
1 parent
f3c5f79
commit e3f64d8
Showing
8 changed files
with
140 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,33 @@ | ||
package main | ||
|
||
import "encoding/json" | ||
|
||
/* | ||
* | ||
func buildNode() pathifyv2.Node[map[string]any] { | ||
john := pathifyv2.New(). | ||
SetValue("firstname", "John"). | ||
SetValue("lastname", "Doe").Out() | ||
wendy := pathifyv2.New(). | ||
SetValue("firstname", "Wendy").Out() | ||
return pathifyv2.New(). | ||
SetValue("salary", 120). | ||
SetValue("dad", john). | ||
SetValue("mom.firstname", "Jane"). | ||
SetValue("mom.lastName", "Dane"). | ||
SetValue("children[0].firstname", "David"). | ||
SetValue("children[0].age", 20). | ||
SetValue("children[0].tutor", wendy) | ||
} | ||
import ( | ||
"strings" | ||
|
||
"github.com/astrokube/pathify" | ||
) | ||
|
||
var peopleArray = []any{ | ||
map[string]any{ | ||
"firstname": "John", | ||
"lastname": "Doe", | ||
"age": 29, | ||
}, | ||
map[string]any{ | ||
"firstname": "Jane", | ||
"lastname": "Moe", | ||
"age": 30, | ||
}, | ||
} | ||
|
||
* | ||
*/ | ||
func main() { | ||
/** | ||
out := complexMapStructure() | ||
b, err := json.MarshalIndent(out, " ", " ") | ||
if err != nil { | ||
println(err.Error()) | ||
//os.Exit(1) | ||
} | ||
p := pathify.Load[[]any](peopleArray).Set( | ||
"[1].lastname", "Doe", | ||
"[0].firstname", "Wendy", | ||
"[2].firstname", "Cindy", | ||
"[1].firstname", strings.ToUpper, | ||
) | ||
b, _ := p.YAML() | ||
println(string(b)) | ||
prettyPrint() | ||
println("------------ Pathify Load ------------") | ||
**/ | ||
//exampleLoad() | ||
printJSON(loadArray()) | ||
// printJSON(loadMap()) | ||
} | ||
|
||
func printJSON(content any) { | ||
b, _ := json.Marshal(content) | ||
b, _ = p.JSON() | ||
println(string(b)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters