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

Foreign keys in DSL #93

Merged
merged 1 commit into from
May 24, 2024
Merged

Foreign keys in DSL #93

merged 1 commit into from
May 24, 2024

Conversation

oyvindberg
Copy link
Owner

@oyvindberg oyvindberg commented Apr 22, 2024

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 oyvindberg force-pushed the foreign-keys-in-dsl branch from 293c6d0 to 008c08a Compare May 20, 2024 20:50
@oyvindberg oyvindberg force-pushed the foreign-keys-in-dsl branch from 008c08a to 70dacd8 Compare May 24, 2024 20:53
@oyvindberg oyvindberg merged commit e1f4923 into main May 24, 2024
7 checks passed
@oyvindberg oyvindberg deleted the foreign-keys-in-dsl branch May 24, 2024 20:56
oyvindberg added a commit that referenced this pull request May 30, 2024
oyvindberg added a commit that referenced this pull request May 30, 2024
* Consistent ordering of `fk*`

followup from #93

* Consistent ordering of columns in (at least) composite keys
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.

1 participant