From 278bcc8cc2c6cc23a77f4b2392fba7689a18fbbb Mon Sep 17 00:00:00 2001 From: loicalleyne Date: Tue, 5 Nov 2024 15:39:00 -0500 Subject: [PATCH] update README --- README.md | 20 +++++++++----------- cmd/main.go | 6 +++++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 3eb0077..52fb0b4 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,11 @@ var jsonS1 string = `{ "timefield":"01:02:03" }` u, _ := bodkin.NewBodkin(jsonS1, bodkin.WithInferTimeUnits(), bodkin.WithTypeConversion()) -s, err := u.OriginSchema() -fmt.Printf("original input %v\nerrors:\n%v\n", s.String(), err) +s, _ := u.OriginSchema() +fmt.Printf("original input %v\n", s.String()) +for _, e := range u.Err() { + fmt.Printf("%v : [%s]\n", e.Issue, e.Dotpath) +} // original input schema: // fields: 5 // - results: type=list, nullable>, nullable @@ -49,9 +52,8 @@ fmt.Printf("original input %v\nerrors:\n%v\n", s.String(), err) // - timefield: type=time64[ns], nullable // - count: type=float64, nullable // - next: type=utf8, nullable -// errors: -// could not determine type of unpopulated field : [previous] -// could not determine element type of empty array : [arrayscalar] +// could not determine type of unpopulated field : [$previous] +// could not determine element type of empty array : [$arrayscalar] ``` Provide some more structured data and print out the new merged schema and the list of changes @@ -109,7 +111,7 @@ Also works with Go structs } e, _ := bodkin.NewBodkin(stu, bodkin.WithInferTimeUnits(), bodkin.WithTypeConversion()) sc, err := e.OriginSchema() - fmt.Printf("original input %v\nerrors:\n%v\n", sc.String(), err) + fmt.Printf("original input %v\n", sc.String()) // original input schema: // fields: 5 // - ID: type=int64, nullable @@ -117,11 +119,9 @@ Also works with Go structs // - School: type=struct>, nullable // - Name: type=utf8, nullable // - Age: type=int32, nullable -// errors: -// e.Unify(sch) sc, err = e.OriginSchema() - fmt.Printf("unified %v\nerrors:\n%v\n", sc.String(), err) + fmt.Printf("unified %v\n", sc.String()) // unified schema: // fields: 5 // - ID: type=int64, nullable @@ -129,8 +129,6 @@ Also works with Go structs // - School: type=struct>, nullable // - Name: type=utf8, nullable // - Age: type=int32, nullable -// errors: -// ``` Use the generated Arrow schema with Arrow's built-in JSON reader to decode JSON data into Arrow records diff --git a/cmd/main.go b/cmd/main.go index 41ce79b..0829023 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -165,7 +165,11 @@ func main() { fmt.Println(err) } fmt.Println(u.Paths()) - fmt.Println(u.Err()) + for _, e := range u.Err() { + fmt.Printf("%v : [%s]\n", e.Issue, e.Dotpath) + } + fmt.Println(u.Changes()) + } var jsonS1 string = `{