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

Provide Get and Put instances for Scala Seq for Doobie module #112

Open
salamonpavel opened this issue Jan 17, 2024 · 2 comments
Open

Provide Get and Put instances for Scala Seq for Doobie module #112

salamonpavel opened this issue Jan 17, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@salamonpavel
Copy link
Contributor

Background

There is no built-in Put and Get for Scala Seq type, only for List. We should provide it as part of the library.

implicit val get: Get[Seq[String]] = Get[List[String]].map(_.toSeq)
implicit val put: Put[Seq[String]] = Put[List[String]].contramap(_.toList)
@salamonpavel salamonpavel added the enhancement New feature or request label Jan 17, 2024
@lsulak
Copy link
Collaborator

lsulak commented Feb 26, 2024

Actually does this mean that if we have a Sequence of Integers, or something else other than String, that we would need an extra pair of these get & put for each, right?

@salamonpavel
Copy link
Contributor Author

Actually does this mean that if we have a Sequence of Integers, or something else other than String, that we would need an extra pair of these get & put for each, right?

I guess we could define it as generic implicit method implicit def getForSeq[T]: Get[Seq[T]]. We could also do a conversion to List in our application code and in such case we wouldn't need this at all. It's up to a discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🆕 To groom
Development

No branches or pull requests

2 participants