bizzabo / play-json-extensions

+22 field case class formatter and more for play-json
http://cvogt.org/play-json-extensions/api/
Other
196 stars 44 forks source link

Handling codegen def and class when case class does not exist #21

Closed ergomesh closed 8 years ago

ergomesh commented 8 years ago

I have a slick codegen that I want to json.toJson for my results sets. Here is an example of a 22+ tuple

implicit def Table1Row(implicit e0: GR[String], e1: GR[Long], e2: GR[Option[String]]): GR[Table1Row] = GR{ prs => import prs._ <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[Long] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[String] :: <<[Long] :: <<[String] :: <<[String] :: <<?[String] :: HNil } /** Table description of table TABLE1. Objects of this class serve as prototypes for rows in queries. */ class Table1(_tableTag: Tag) extends Table[Table1Row](_tableTag, Some("Schema"), "TABLE1") { def * = x1 :: x2 :: x3 :: x4 :: x5 :: x6 :: x7 :: x8 :: x9 :: x10 :: x11 :: x12 :: x13 :: x14 :: x15 :: x16 :: x17 :: x18 :: x19 :: x20 :: x21 :: x22 :: x23 :: x24 :: x25 :: x26 :: x27 :: x28 :: x29 :: x30 :: x31 :: x32 :: x33 :: x34 :: x35 :: x36 :: x37 :: x38 :: x39 :: x40 :: x41 :: x42 :: x43 :: x44 :: x45 :: x46 :: x47 :: x48 :: x49 :: x50 :: x51 :: x52 :: x53 :: x54 :: HNil

Is there any way to render this as Json using the extension?

cvogt commented 8 years ago

No. This extension does not support Slick's HList. Hopefully somebody will implement additional features for the Slick code generator as a Google Summer of Code project.