clockworklabs / clockworklabs/SpacetimeDB

Make (Anonymous)ViewContext trait methods public in rust server modules

Open
#3,754 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

You can use ctx.db().table().index() methods from reducers where ever you define them.

But the methods created for indices for the new ViewContext / AnonymousViewContext use the column / struct field's visibility instead of the public one.

This means if you want to define view functions outside of the module where you have defined a table, you need to make the indexed colums visibilities non-inherited (=pub).

Got an issue here https://github.com/tamaro-skaljic/SpacetimeDSL/issues/90 where someone said they can't create views because the primary key column is private.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how index methods are created for ViewContext and AnonymousViewContext in the Rust server modules, using ctx.db().table().index() from a reducer outside the table’s module as the reproduction. Verify that indexed columns or struct fields with inherited or private visibility still expose usable public methods, and confirm the external view compiles and works.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.