-
Notifications
You must be signed in to change notification settings - Fork 6
Add tuple support #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ var chTypeHandlers = map[string]chScanHandler{ | |
| "Decimal": handleDecimal, | ||
| "Bool": handleBool, | ||
| "Array": handleArray, | ||
| "Tuple": handleTuple, | ||
| } | ||
|
|
||
| // Type handler signature | ||
|
|
@@ -146,19 +147,33 @@ func handleDecimal(nullable bool) (any, func() any) { | |
| return val | ||
| } | ||
| } | ||
| func handleTuple(nullable bool) (any, func() any) { | ||
| if nullable { | ||
| var p *any | ||
| return &p, func() any { | ||
| if p == nil || *p == nil { | ||
| return nil | ||
| } | ||
| return *p | ||
| } | ||
| } | ||
| var v any | ||
| return &v, func() any { return v } | ||
| } | ||
|
|
||
|
|
||
| func handleArray(nullable bool) (any, func() any) { | ||
| if nullable { | ||
| var p *[]any | ||
| return &p, func() any { | ||
| if p == nil { | ||
| return nil | ||
| } | ||
| return *p | ||
| } | ||
| } | ||
| var v []any | ||
| return &v, func() any { return v } | ||
| if nullable { | ||
| var p *any | ||
| return &p, func() any { | ||
| if p == nil || *p == nil { | ||
| return nil | ||
| } | ||
| return *p | ||
| } | ||
| } | ||
| var v any | ||
| return &v, func() any { return v } | ||
|
Comment on lines
165
to
+176
|
||
| } | ||
|
|
||
| func handleDefault(nullable bool) (any, func() any) { | ||
|
|
@@ -191,6 +206,9 @@ func unwrapCHType(t string) (base string, nullable bool) { | |
| if strings.HasPrefix(s, "Array(") { | ||
| return "Array", nullable | ||
| } | ||
| if strings.HasPrefix(s, "Tuple(") { | ||
| return "Tuple", nullable | ||
| } | ||
|
Comment on lines
+209
to
+211
|
||
|
|
||
| // Decimal(N,S) normalize to "Decimal" | ||
| if isDecimal(s) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New code in handleTuple uses spaces for indentation and doesn’t match the rest of this Go file’s gofmt/tab formatting. Please run gofmt (or reformat this block) so indentation and brace alignment are consistent.