clockworklabs / clockworklabs/SpacetimeDB
Make (Anonymous)ViewContext trait methods public in rust server modules
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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