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

datum: Add support for bundle.tracked_row_add in AQ.Relation.insert() #72

Closed
erichanson opened this issue Aug 16, 2017 · 2 comments
Closed

Comments

@erichanson
Copy link
Member

When inserting a new row in the database, a common pattern is to also want to add that row to the appropriate bundle. Add an option on datum insert for also tracking the row in the specified bundle.

@erichanson erichanson changed the title Add support for bundle.stage_row_add in datum.js insert Add support for bundle.tracked_row_add in datum.js insert Aug 16, 2017
@erichanson
Copy link
Member Author

Alternately, create a bundle manip library that builds on top of datum, for doing client side bundle operations. Currently, for example, to call bundle.tracked_row_add(bundle_name text, schema_name text, relation_name text, pk_column_name text, pk_value text) from datum looks like this rather verbose call to AQ.Schema.function():

        endpoint.schema('bundle').function('tracked_row_add', [
            bundle.get('name'),
            'documentation',
            'bundle_doc',
            'id',
            bundle_doc.get('id')
        ]).then(function(result) {
            // ...
        });

It should be possible do something higher-level, that just does the above under the hood, like:

AQ.bundle.tracked_row_add(
    bundle.get('name'),
    'documentation',
    'bundle_doc',
    'id',
    bundle_doc.get('id')
).then(function(result) {
    // ...
}).catch(function(err) {
    // ...
});

So maybe create a bundle.js library? It would sure be nice if this functionality was just mixed into the datum library though, with something like:

    endpoint.schema('documentation').table('bundle_doc').insert({
        bundle_id: bundle.get('id'),
        content: '# '+bundle.get('name')+"\n"
    }, {
        // insert options here, e.g.
        tracked_row_add: 'org.aquameta.core.ide'
    }).then(function(bundle_doc) {

It does conflate separations of concerns between endpoint/datum and bundle though. Hmm.

@erichanson erichanson changed the title Add support for bundle.tracked_row_add in datum.js insert datum: Add support for bundle.tracked_row_add in AQ.Relation.insert() Sep 17, 2020
@erichanson
Copy link
Member Author

This issue is the tip of the iceberg. Endpoint needs a whole new bag, ala #228.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant