Neilk1021 opened a new pull request, #7057:
URL: https://github.com/apache/texera/pull/7057

   ### What changes were proposed in this PR?
   Classes relying on the POJO User generated by jOOq uses its positional 
constructor which is fragile and requires us to refactor every constructor 
every time we edit the User table even if the new fields aren't used. Most 
instances of User() called it with mostly null fields which is hard to read and 
isn't very clear. 
   
   This PR changes that by using the .tap{} feature of Scala which allows you 
to construct and modify objects in place before assigned as a parameter or 
variable. 
   
   This allows code like this:
   ```scala
     val GUEST: User =
       new User(null, "guest", null, null, null, null, UserRoleEnum.REGULAR, 
null, null, null, null)
   ```
   To be rewritten like this 
   ```scala
   val GUEST: User = {
     new User().tap { user =>
       user.setName("guest")
       user.setRole(UserRoleEnum.REGULAR)
     }
   }
   ```
   
   ### Any related issues, documentation, discussions?
   Closes #7044
   
   ### How was this PR tested?
   PR was tested against current test suite. 
   
   ### Was this PR authored or co-authored using generative AI tooling?
   No.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to