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

Add JSON marshaller #22

Merged
merged 3 commits into from
Apr 1, 2022
Merged

Add JSON marshaller #22

merged 3 commits into from
Apr 1, 2022

Conversation

mFat7y
Copy link
Collaborator

@mFat7y mFat7y commented Mar 31, 2022

No description provided.

@kelindar
Copy link
Owner

Coverage decreased, please make sure tests are covering all new changes

@@ -199,3 +200,17 @@ func resize(capacity, v int) int {
}
return capacity
}

func (dst Bitmap) MarshalJSON() ([]byte, error) {
Copy link
Owner

Choose a reason for hiding this comment

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

Add comments

return json.Marshal(dst.ToBytes())
}

func (dst *Bitmap) UnmarshalJSON(data []byte) (err error) {
Copy link
Owner

Choose a reason for hiding this comment

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

Add comments

bitmap.go Outdated
}

func (dst *Bitmap) UnmarshalJSON(data []byte) (err error) {
d := []byte{}
Copy link
Owner

Choose a reason for hiding this comment

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

preallocate instead of creating an empty one

@kelindar kelindar merged commit 9b9fa52 into kelindar:main Apr 1, 2022
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