Skip to content

Request: Ability to store multiple values together to increment or decrement. statsCounter #4

@amp127

Description

@amp127

I'm tracking 15 different things for each org and often will increment or decrement multiple values within one mutation. The current use doesn't scale great, especially when you need sharding. A Stats like mode would be great.

In the ideal state this would be most helpful:
const statsForOrg = statsCounter.for("w57tj7fretc11ct91frbqwf2qh721exr");
await statsForOrg.inc(ctx, 'views'); // increment
await statsForOrg.dec(ctx, 'spentTokens'); // decrement
await statsForOrg.add(ctx, 'rank', 5); // add 5
await statsForOrg.subtract(ctx, 'tokens' , 2); // subtract 2
await statsForOrg.getAll(ctx)
await statsForOrg.estimateCounts(ctx, "w57tj7fretc11ct91frbqwf2qh721exr")
await statsForOrg.rebalance(ctx, "w57tj7fretc11ct91frbqwf2qh721exr");

however having the value support a string or v.any would allow for similar manual programming of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions