Comments (6)
If that works I’ll push it into the next version for you!
from postgrest-csharp.
Available in v2.1.0!
from postgrest-csharp.
You mean something like this?
var supabotMessages = await client.Table<Message>().Filter("id", Postgrest.Constants.Operator.Equals, id).Get();
from postgrest-csharp.
Well sort of yeah. Just without the verbosity of "id", Postgrest.Constants.Operator.Equals, id
.
The primary keys are already annotated so I was hoping there would be a way to skip the verbose filter statements. For multi col keys in particular it's quite the hassle to create dicts and stuff.
[Table("my_model")]
public class MyModel: BaseModel
{
[PrimaryKey("id_2")]
public string Id1 { get; set; }
[PrimaryKey("id_2")]
public string Id2{ get; set; }
[PrimaryKey("id_3")]
public string Id3 { get; set; }
[Column("my_col")]
public short MyCol{ get; set; }
//....
}
would result in a query like:
var filters = new Dictionary<string, string>()
{
{"id_1", localModel.Id1 },
{"id_2", localModel.Id2 },
{"id_3", localModel.Id3 },
};
var dbModel = postgrestClient.Table<MyModel>().Match(filters).Get();
where to me it feels like the dict creation part should be able to be created automatically based on the [PrimaryKey(xx)]
annotations.
Hope that makes sense :D
from postgrest-csharp.
Oh yes! Very nice.
I've added the following on the master
branch.
var moviePerson = new MoviePerson { Id = 1, MovieId = 1, PersonId = 1 };
var findMoviePerson = await client.Table<MoviePerson>().Match(moviePerson).Single();
Is that better? (This tangentially required better supporting composite primary keys, which is appreciated!)
from postgrest-csharp.
Awesome, yeah the syntax looks very nice, thank you👌
from postgrest-csharp.
Related Issues (20)
- URI too long when filtering with big lists HOT 5
- Random issues when sending data to API HOT 4
- About Insert Method HOT 10
- Postgrest `Reference` attribute is producing StackOverflow for circular references HOT 1
- Ignoring `null` in a JSONB column using `record` HOT 2
- Can't send a C# object to Postgrest through RPC (jsonb)
- Issue sending non-string data through RPC HOT 6
- Using LINQ expression to handle DateTime comparisons produces inconsistent results. HOT 4
- [Chore] Add tests for different Date and Timezone configurations
- Can't use "Contains" collection method to filter tables HOT 11
- Get not working when PK is Text Type
- Getting System.NotSupportedException on Azure App Service HOT 2
- Calls to `Insert` and `Update` fail when a `Reference` is specified on a Model HOT 10
- Can't use `Table<TModel>.Where(Expression<Func<TModel, bool>> predicate)` with more than 2 or'ed conditions in the predicate expression HOT 5
- Using multiple `.Order()` methods when querying doesn't work as expected. HOT 5
- Improve `QueryFilter`/`Where`/`Filter` Implementation and Documentation
- shouldFilterTopLevel should be changed in documentation HOT 1
- Non-updatable Attribute HOT 2
- Delete returns a success status code even if it actually failed due to RLS policies HOT 1
- Update return types of IPostgrestTable<TModel> from Table<TModel> to IPostgrestTable<TModel> HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postgrest-csharp.