GithubHelp home page GithubHelp logo

RelationProxy reset query about dpq HOT 2 OPEN

irenejmarc avatar irenejmarc commented on August 15, 2024
RelationProxy reset query

from dpq.

Comments (2)

IrenejMarc avatar IrenejMarc commented on August 15, 2024

RelationProxy, being an unfinished API is not exactly what I had planned initially.

The current idea is to not change the state in the RelationProxy itself but instead make a copy and modify the state in that. That'll allow you to reuse the same initial instance of multiple times and just build queries on top of that like such:

auto rp = RelationProxy!User;
auto allRows = rp.all;
auto filteredRows = rp.where("row = 1").all;
// and so on

This eliminates all need to reset the state/queries.

The current solution is to use the RelationMixin inside User since each of its methods spawns another instance of RelationProxy.

from dpq.

Betelgeyser avatar Betelgeyser commented on August 15, 2024

That clarifies a bit.

But this approach renders caching unusable since in the case of copying the initial RelationProxy it will always be marked as 'stale'. Or rather difficult to make a RelationProxy to track if the new chain can use cached data from the previous one. Besides, user can easily make his/her own cache like this:

auto rp = RelationProxy!User;
auto cachedUsers = rp.all;

Should the caching be maintained somehow or be just removed from the RelationProxy?

from dpq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.