Announcement

Collapse
No announcement yet.

Future of BaseQueryComposer and notStorable fields

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Future of BaseQueryComposer and notStorable fields

    BaseQueryComposer is a huge class (3500+ lines of code) with lots of undocumented features, such as - whereDefs with leftJoins, sub queries, havingClauses... which are especially useful for notStorable fields. A lot of these things can be implemented with modern and documented selectDefs (e.g. whereItemConverterClassNameMap) and recordDefs (e.g. readLoaderClassNameList). I realize that these things function completely differently, but unless performance is an issue, it seems to me that it's an arbitrary choice which approach to take.

    My question is - what are the plans for the future? Are things like whereDefs deprecated? Do you have any tips for creating notStorable fields?
    Last edited by mozkomor; 08-24-2022, 05:00 PM.

  • #2
    It was written 10 years ago. It's not supposed to be extended unless you want to implement other database support (like Postgres), even this won't require a lot of changes. It's well tested and not that complex actually. Maybe in future I'll refactor it but it won't give a lot of benefits as in most cases developers are not supposed to look into it to solve problems. Devs should use abstractions (query builders, RDB repository). Those are fully documented.

    Comment


    • mozkomor
      mozkomor commented
      Editing a comment
      Custom query composers for other database support is something we've been thinking about implementing. Can't wait for `queryComposerClassNameMap` to be released .

    • mozkomor
      mozkomor commented
      Editing a comment
      > It's not supposed to be extended unless you want to implement other database support

      Sure, but it lacks some features. For example: it would be cool to be able to use `havingClause` inside `where`. As a workaround I had to use subquery, decreasing performance on larger tables. I get that `where` isn't supposed to change different parts of query (i.e. HAVING) and implementing such change would be impractical. Changing HAVING can be achieved using `ItemConverters` as they can access `QueryBuilder`, which makes me wonder what even is the point of having whereDefs ('where' in attribute defs).
      Last edited by mozkomor; 08-24-2022, 06:35 PM.

  • #3
    > Are things like whereDefs deprecated

    Not sure what you mean by that. Those things that concerns metadata ('where' in attribute defs) are indeed not documented in our docs. These are not deprecated and not planned to be.

    Comment


    • #4
      Originally posted by yuri View Post
      > Are things like whereDefs deprecated

      Not sure what you mean by that. Those things that concerns metadata ('where' in attribute defs) are indeed not documented in our docs. These are not deprecated and not planned to be.
      Great. Thank you very much for the info. However if these are not planned to be deprecated, whats the point of using them? Everything they can do and more can be achieved using `ItemConverters`. I guess it might be faster, since it doesn't have any abstraction.
      Last edited by mozkomor; 08-24-2022, 06:34 PM.

      Comment


      • esforim
        esforim commented
        Editing a comment
        Kharg Not aware of any extension, if got an account I can give you access to edit.

        Disregard that first sentence, found it: https://github.com/mozkomor05/espocr...view-extension
        I will add, but the "edit access" offer still available.

        And wow mozkomor made a YT-Bypass userscript. I'm a user of that extension.
        Last edited by esforim; 08-27-2022, 01:01 AM.

      • Kharg
        Kharg commented
        Editing a comment
        esforim My username in Github is Kharg.
        He has also made other extensions if you check his github you'll find them!

      • esforim
        esforim commented
        Editing a comment
        Kharg Invited you to be Collaborator, hope it work. Feel free to edit as you see fit; there isn't really a standard. Only rules is: Try your best to put in the right 'category'; give a relevant description/title and importantly a link to the thread/post/website.
    Working...
    X