typo icon indicating copy to clipboard operation
typo copied to clipboard

Foreign keys in DSL

Open oyvindberg opened this issue 10 months ago • 0 comments

these are generated in Fields objects so othey are accessible in DSL:

generated boilerplate:

  def fkEmployee: ForeignKey[EmployeeFields, EmployeeRow] =
    ForeignKey[EmployeeFields, EmployeeRow]("humanresources.FK_JobCandidate_Employee_BusinessEntityID", Nil)
      .withColumnPair(businessentityid, _.businessentityid)

usage:

      val query0 = productRepo.select
        .joinFk(_.fkProductmodel)(projectModelRepo.select)
        .joinFk(_._1.fkProductsubcategory)(productsubcategoryRepo.select)
        .joinFk(_._2.fkProductcategory)(productcategoryRepo.select)
      query0.toList.foreach(println)

oyvindberg avatar Apr 22 '24 20:04 oyvindberg