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

db/unjoiner: remove extra sql`` wrapper #1374

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Jan 17, 2025

  • simpler code
  • minor optimisation
  • resolves FIXME

Introduced in #1240, but not resolved before merge.

What has been done to verify that this works as intended?

CI

Why is this the best possible solution? Were any other approaches considered?

No other approaches were considered.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

No effect.

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

No.

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

alxndrsn added 2 commits January 17, 2025 05:55
* simpler code
* minor optimisation
* resolves FIXME
@@ -252,7 +252,7 @@ describe('util/db', () => {
it('should provide the appropriate arguments when extended', () => {
let run = false;
extender(T)(U)((fields, extend, options, x, y, z) => {
fields.should.eql(sql`"frames"."x" as "frames!x","frames"."y" as "frames!y","a" as "a","b" as "b"`);
sql`${fields}`.should.eql(sql`"frames"."x" as "frames!x","frames"."y" as "frames!y","a" as "a","b" as "b"`);
Copy link
Contributor Author

@alxndrsn alxndrsn Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative (no sql wrapper for fields) would make for a much less readable assertion:

{                                                                                                                       
  "glue": {                                                                                                                
    "sql": ","                                                                                                             
    "type": Symbol(SLONIK_TOKEN_SQL)                                                                                       
    "values": []                                                                                                           
  }                                                                                                                        
  "members": [                                                                                                             
    {                                                                                                                      
      "sql": "\"frames\".\"x\" as \"frames!x\""                                                                            
      "type": Symbol(SLONIK_TOKEN_SQL)                                                                                     
      "values": []                                                                                                         
    }                                                                                                                      
    {                                                                                                                      
      "sql": "\"frames\".\"y\" as \"frames!y\""                                                                            
      "type": Symbol(SLONIK_TOKEN_SQL)                                                                                     
      "values": []                                                                                                         
    }                                                                                                                      
    {                                                                                                                      
      "sql": "\"a\" as \"a\""                                                                                              
      "type": Symbol(SLONIK_TOKEN_SQL)                                                                                     
      "values": []                                                                                                         
    }                                                                                                                      
    {                                                                                                                      
      "sql": "\"b\" as \"b\""                                                                                              
      "type": Symbol(SLONIK_TOKEN_SQL)                                                                                     
      "values": []                                                                                                         
    }                                                                                                                      
  ]                                                                                                                        
  "type": Symbol(SLONIK_TOKEN_LIST)                                                                                        
}  

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