Skip to content

Can't Use Where Clause With Enums. #66

Closed
@h4ckitt

Description

@h4ckitt

Bug report

Describe the bug

I Have An Enum

public enum Status {Approved, Declined, Pending}

And A Class

[Table("request")]
public class Request {
   [PrimaryKey("id")]
   public string id {get; set;}
   [Column("name")]
   public string Name {get; set;}
   [Column("status")]
   public Status status = Status.Pending;
}

I Can Insert The Status Into The Database Alright, But When Trying To Retrieve Data From he Database Like So

  _client.From<Request>.Where(x => x.id == "1" && x.Status == Status.Pending).Single().Result;

I Get The Following Error:
Left side of expression: '(Convert(x.Status, Int32) == 2)' is expected to be property with a ColumnAttribute or PrimaryKeyAttribute

The Annotations Are Present And Correct.

I'll Appreciate Any Help I Can Get, Thanks.

To Reproduce

Described Above

Expected behavior

Fetch Record From The DB Whose Id And Status Matches The Specification Provided.

System information

  • OS: Linux
  • Browser: N/A
  • Version of supabase-js: N/A
  • Version of Node.js: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions