-
Notifications
You must be signed in to change notification settings - Fork 0
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
Devel #1
Devel #1
Conversation
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.
Looking pretty darn good. Just ran through a few files quickly. Here are a few suggestions to polish things up a bit.
.vscode/launch.json
Outdated
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ |
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.
Remove this file
benchmark_test.go
Outdated
var jsonData []byte | ||
var gobData bytes.Buffer | ||
var msgPackData []byte | ||
var xmlData *bytes.Buffer = &bytes.Buffer{} |
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.
For consistency, change to var xmlData bytes.Buffer
and adjust other code accordingly
benchmark_test.go
Outdated
|
||
// SchemaSchema() is here so we can only create the schemer schema once | ||
// and then reuse it over and over | ||
func createSchemerSchema() { |
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.
Unnecessary abstraction: Function is used exactly once and only contains one line of code.
benchmark_test.go
Outdated
|
||
func BenchmarkSchemerEncodeOnly(b *testing.B) { | ||
|
||
createSchemerSchema() |
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.
The time to create the schema is included in the benchmark! Per the Go docs, use b.ResetTimer()
benchmark_test.go
Outdated
|
||
func schemerEncoder() int { | ||
|
||
schemerCounter++ |
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.
Instead of using this counter, clear the Buffer beforehand.
fixedobject.go
Outdated
|
||
// The most signifiant bit indicates whether or not the type is nullable | ||
if s.SchemaOptions.Nullable { | ||
schemaBytes[0] |= 128 |
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.
I think 0x80
is clearer
fixedobject.go
Outdated
for i := 0; i < len(s.Fields); i++ { | ||
|
||
f := v.Field(i) | ||
err := s.Fields[i].Schema.Encode(w, f.Interface()) |
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.
Use EncodeValue
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.
One thing to note here is that we don't have a function EncodeValue(). (We have DecodeValue() only)
fixedobject.go
Outdated
return nil | ||
} | ||
|
||
var CacheMap map[string]string |
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.
Maybe do not export?
fixedobject.go
Outdated
// and see if there is anywhere we can put them | ||
for i := 0; i < len(s.Fields); i++ { | ||
|
||
Foundmatch := false |
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.
Rename to found
fixedobject.go
Outdated
|
||
var ignoreMe interface{} | ||
/* | ||
if stringToMatch == "String1" { |
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.
Please clean up old comments where appropriate
Added TODO comments for code review Misc. refactoring
Please merge entire development branch into main.