clockworklabs / clockworklabs/SpacetimeDB
SQL query syntax for enums
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
I am using C# and I have a column defined in a table using an enum like so:
[Type]
public enum Topping
{
Cheese,
Ham,
Mushroom,
}
[Table(Name = "pizza", Public = true)]
public partial class Pizza
{
[AutoInc]
[PrimaryKey]
public int Id;
public Topping Topping;
}
When I query "SELECT * from pizza" I get a result like:
Id | Topping
------+----------------
2248 | (Cheese = ())
2249 | (Ham = ())
2250 | (Ham = ())
But what is the syntax for querying based on the Topping column e.g. "SELECT * from pizza WHERE Topping = Ham"?
I couldn't find any info in the docs about this. It would be a welcome addition to add some examples of queries with WHERE clauses on other data types e.g. enums and structs.
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 from the C# enum and Pizza table definition shown in the issue, then verify the syntax for filtering enum columns in a SELECT WHERE clause. Document the working query and, if supported, add examples covering enum and struct values; done means a newcomer can find and use these examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100