Skip to content
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

Closed
wants to merge 53 commits into from
Closed

Devel #1

wants to merge 53 commits into from

Conversation

BenjaminPritchard
Copy link
Collaborator

Please merge entire development branch into main.

Copy link
Owner

@bminer bminer left a 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.

// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file

var jsonData []byte
var gobData bytes.Buffer
var msgPackData []byte
var xmlData *bytes.Buffer = &bytes.Buffer{}
Copy link
Owner

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


// SchemaSchema() is here so we can only create the schemer schema once
// and then reuse it over and over
func createSchemerSchema() {
Copy link
Owner

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.


func BenchmarkSchemerEncodeOnly(b *testing.B) {

createSchemerSchema()
Copy link
Owner

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()


func schemerEncoder() int {

schemerCounter++
Copy link
Owner

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
Copy link
Owner

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())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use EncodeValue

Copy link
Collaborator Author

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
Copy link
Owner

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
Copy link
Owner

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" {
Copy link
Owner

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

@bminer bminer closed this Oct 11, 2021
@bminer bminer deleted the devel branch October 11, 2021 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants