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

Optimize encoders and skip nul fields #247

Merged
merged 7 commits into from
Jul 8, 2021
Merged

Optimize encoders and skip nul fields #247

merged 7 commits into from
Jul 8, 2021

Conversation

joroKr21
Copy link
Collaborator

@joroKr21 joroKr21 commented Jul 7, 2021

Also add Contravariant instances (enable use of narrow)

Sorry for the big PR 🙈
Fixes #246

Copy link
Collaborator

@markus1189 markus1189 left a comment

Choose a reason for hiding this comment

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

That's a fast turnaround time for #246 @joroKr21 ❤️ . I had a look and added some comments.

Most importantly, I would like to have a dedicated test with a link to #246, to document it explicitly

src/main/scala/scynamo/ScynamoEncoder.scala Show resolved Hide resolved
src/main/scala/scynamo/ScynamoEncoder.scala Outdated Show resolved Hide resolved
src/main/scala/scynamo/ScynamoEncoder.scala Outdated Show resolved Hide resolved
src/main/scala/scynamo/ScynamoEncoder.scala Show resolved Hide resolved
src/main/scala/scynamo/ScynamoEncoder.scala Show resolved Hide resolved
src/main/scala/scynamo/ScynamoEncoder.scala Show resolved Hide resolved
src/main/scala/scynamo/ScynamoEncoder.scala Outdated Show resolved Hide resolved
Copy link
Member

@saeltz saeltz left a comment

Choose a reason for hiding this comment

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

Awesome!

src/main/scala/scynamo/ScynamoEncoder.scala Show resolved Hide resolved
src/main/scala/scynamo/ScynamoDecoder.scala Outdated Show resolved Hide resolved
@joroKr21 joroKr21 requested review from markus1189 and saeltz July 8, 2021 11:30
Copy link
Member

@saeltz saeltz left a comment

Choose a reason for hiding this comment

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

Thanks for adding the tests as well!

src/main/scala/scynamo/ScynamoEncoder.scala Show resolved Hide resolved

def contramap[B](f: B => A): ScynamoEncoder[B] = value => self.encode(f(value))
def contramap[B](f: B => A): ScynamoEncoder[B] =
ScynamoEncoder.instance(value => self.encode(f(value)))
Copy link
Member

Choose a reason for hiding this comment

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

(Nitpicking:) I'm irritated by all these new line breaks. Do you make them on purpose?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes - I find it hard to read such long lines without a break

@joroKr21 joroKr21 merged commit 08a23e5 into master Jul 8, 2021
@joroKr21 joroKr21 deleted the encoder branch July 8, 2021 13:06
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.

Option encoding behavior causing problems with GlobalSecondaryIndizes
3 participants