Supabase.Postgrest Used to map a C# property to a Postgrest Column. class User : BaseModel { [ColumnName("firstName")] public string FirstName {get; set;} } The name in postgres of this column. Specifies what should be serialized in the event this column's value is NULL If the performed query is an Insert or Upsert, should this value be ignored? If the performed query is an Update, should this value be ignored? Used to map a C# property to a Postgrest PrimaryKey. class User : BaseModel { [PrimaryKey("id")] public string Id {get; set;} } Would be set to false in the event that the database handles the generation of this property. Used to specify that a foreign key relationship exists in PostgreSQL See: https://postgrest.org/en/stable/api.html#resource-embedding Specifies the Join type on this reference. PostgREST only allows for a LEFT join and an INNER join. INNER JOIN: returns rows when there is a match on both the source and the referenced tables. LEFT JOIN: returns all rows from the source table, even if there are no matches in the referenced table Type of the model referenced Column this attribute references as specified in Postgres, DOES NOT need to be set if is set. The explicit SQL defined foreign key that this references. Table name of model Columns that exist on the model we will select from. If the performed query is an Insert or Upsert, should this value be ignored? (DEFAULT TRUE) If the performed query is an Update, should this value be ignored? (DEFAULT TRUE) If Reference should automatically be included in queries on this reference. (DEFAULT TRUE) As to whether the query will filter top-level rows. See: https://postgrest.org/en/stable/api.html#resource-embedding Establishes a reference between two tables Model referenced Should referenced be included in queries? Specifies the join type for this relationship Column this attribute references as specified in Postgres, DOES NOT need to be set if <see cref="ForeignKey"/> is set. Foreign Key this attribute references as specified in Postgres (only required if the model references the same table multiple times) Establishes a reference between two tables Model referenced Should referenced be included in queries? As to whether the query will filter top-level rows. Column this attribute references as specified in Postgres, DOES NOT need to be set if is set. Foreign Key this attribute references as specified in Postgres (only required if the model references the same table multiple times) Parses relationships that exist on this model. Called by Used to map a C# Model to a Postgres Table. [Table("user")] class User : BaseModel { [ColumnName("firstName")] public string FirstName {get; set;} } Custom Serializer resolvers and converters that will be used for encoding and decoding Postgrest JSON responses. By default, Postgrest seems to use a date format that C# and Newtonsoft do not like, so this initial configuration handles that. Function that can be set to return dynamic headers. Headers specified in the constructor options will ALWAYS take precedence over headers returned by this function. Should be the first call to this class to initialize a connection with a Postgrest API Server Api Endpoint (ex: "http://localhost:8000"), no trailing slash required. Optional client configuration. Options that can be passed to the Client configuration See: https://postgrest.org/en/v7.0.0/api.html?highlight=operators#operators See: https://postgrest.org/en/v7.0.0/api.html?highlight=nulls%20first#ordering See: https://postgrest.org/en/v7.0.0/api.html?highlight=count#estimated-count Used by Newtonsoft.Json to convert a C# range into a Postgrest range. A Singleton used for debug notifications Returns the Singleton Instance. Adds a debug listener Removes a debug handler. Clears debug handlers. Notifies debug listeners. https://postgrest.org/en/v10.2/errors.html?highlight=exception#http-status-codes Errors from Postgrest are wrapped by this exception The response object from Postgrest The content of the response object from Postgrest The HTTP status code of the response object from Postgrest Postgres client's best effort at decoding the error from the GoTrue server. Attempts to decode the error from the GoTrue server. Adds functionality to get a typed Attribute attached to an enum value. Gets a typed Attribute attached to an enum value. Adds functionality to transform a C# Range to a Postgrest String. https://www.postgresql.org/docs/14/rangetypes.html Transforms a C# Range to a Postgrest String. Pull the instance info out of the Uri Pull the instance info out of the Uri Helper to make a request using the defined parameters to an API Endpoint and coerce into a model. Helper to make a request using the defined parameters to an API Endpoint. Prepares the request with appropriate HTTP headers expected by Postgrest. Delegate representing the request to be sent to the remote server. A internal singleton used for hooks applied to and Returns the Singleton Instance. Adds a handler that is called prior to a request being sent. Removes an handler. Clears all handlers. Notifies all listeners. A caching provider than can be used by postgrest to store requests. Gets an item from a caching solution, should coerce into a datatype. This will most likely be a JSON deserialization approach. A reproducible key for a defined query. Sets an item within a caching solution, should store in a way that the data can be retrieved and coerced into a generic type by This will most likely be a JSON serialization approach. A reproducible key for a defined query. An object of serializable data. Clear an item within a caching solution by a key. A reproducible key for a defined query. An empty/clear cache implementation. Client interface for Postgrest API Base Url for subsequent calls. The Options was initialized with. Adds a handler that is called prior to a request being sent. Removes an handler. Clears all handlers. Adds a debug handler Removes a debug handler /// Clears debug handlers Perform a stored procedure call. The function name to call The parameters to pass to the function call Perform a stored procedure call. The function name to call The parameters to pass to the function call A type used for hydrating the HTTP response content (hydration through JSON.NET) A hydrated model Returns a Table Query Builder instance for a defined model - representative of `USE $TABLE` Custom Model derived from `BaseModel` Returns a Table Query Builder instance with a Cache Provider for a defined model - representative of `USE #$TABLE` Interface for getting debug info from Postgrest Adds a debug handler Removes a debug handler Clears debug handlers Logs a message Client interface for Postgrest API Base Url for subsequent calls. Name of the Table parsed by the Model. Generates the encoded URL with defined query parameters that will be sent to the Postgrest API. Adds an AND Filter to the current query args. Clears currently defined query values. By using the columns query parameter it’s possible to specify the payload keys that will be inserted and ignore the rest of the payload. The rest of the JSON keys will be ignored. Using this also has the side-effect of being more efficient for Bulk Insert since PostgREST will not process the JSON and it’ll send it directly to PostgreSQL. See: https://postgrest.org/en/stable/api.html#specifying-columns By using the columns query parameter it’s possible to specify the payload keys that will be inserted and ignore the rest of the payload. The rest of the JSON keys will be ignored. Using this also has the side-effect of being more efficient for Bulk Insert since PostgREST will not process the JSON and it’ll send it directly to PostgreSQL. See: https://postgrest.org/en/stable/api.html#specifying-columns Returns ONLY a count from the specified query. See: https://postgrest.org/en/v7.0.0/api.html?highlight=count The kind of count. Executes a delete request using the defined query params on the current instance. Executes a delete request using the model's primary key as the filter for the request. Add a Filter to a query request Column Name in Table. Operation to perform. Value to filter with, must be a `string`, `List<object>`, `Dictionary<string, object>`, `FullTextSearchConfig`, or `Range` Add a filter to a query request using a predicate to select column. Expects a columns from the Model to be returned Operation to perform. Value to filter with, must be a `string`, `List<object>`, `Dictionary<string, object>`, `FullTextSearchConfig`, or `Range` Executes the query using the defined filters on the current instance. Executes a BULK INSERT query using the defined query params on the current instance. A typed model response from the database. Executes an INSERT query using the defined query params on the current instance. A typed model response from the database. Sets a limit with an optional foreign table reference. Finds all rows whose columns match the specified `query` object. The object to filter with, with column names as keys mapped to their filter values. Fills in query parameters based on a given model's primary key(s). A model with a primary key column Adds a NOT filter to the current query args. Adds a NOT filter to the current query args. Adds a NOT filter to the current query args. Expects a column from the model to be returned. Adds a NOT filter to the current query args. Allows queries like: await client.Table<User>().Not("status", Operators.In, new List<string> {"AWAY", "OFFLINE"}).Get(); Adds a NOT filter to the current query args. Allows queries like: await client.Table<User>().Not("status", Operators.In, new List<string> {"AWAY", "OFFLINE"}).Get(); Expects a column from the model to be returned. Adds a NOT filter to the current query args. Allows queries like: await client.Table<User>().Not("status", Operators.Equal, "OFFLINE").Get(); Adds a NOT filter to the current query args. Allows queries like: await client.Table<User>().Not("status", Operators.Equal, "OFFLINE").Get(); Expects a column from the model to be returned. Sets an offset with an optional foreign table reference. By specifying the onConflict query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint. Set an onConflict query parameter for UPSERTing on a column that has a UNIQUE constraint using a linq predicate. Expects a column from the model to be returned. Adds a OR Filter to the current query args. Adds an ordering to the current query args. NOTE: If multiple orderings are required, chain this function with another call to Order(Expression{Func{T,object}},Ordering,NullPosition) . Column Name Adds an ordering to the current query args using a predicate function. NOTE: If multiple orderings are required, chain this function with another call to Order(Expression{Func{T,object}},Ordering,NullPosition) . >Expects a columns from the Model to be returned Adds an ordering to the current query args. NOTE: If multiple orderings are required, chain this function with another call to Order(Expression{Func{T,object}},Ordering,NullPosition) . Sets a FROM range, similar to a `StartAt` query. Sets a bounded range to the current query. Select columns for query. Select columns using a predicate function. For example: `Table<Movie>().Select(x => new[] { x.Id, x.Name, x.CreatedAt }).Get();` Expects an array of columns from the Model to be returned. Filter a query based on a predicate function. Note: Chaining multiple calls will be parsed as an "AND" query. Examples: `Table<Movie>().Where(x => x.Name == "Top Gun").Get();` `Table<Movie>().Where(x => x.Name == "Top Gun" || x.Name == "Mad Max").Get();` `Table<Movie>().Where(x => x.Name.Contains("Gun")).Get();` `Table<Movie>().Where(x => x.CreatedAt <= new DateTime(2022, 08, 21)).Get();` `Table<Movie>().Where(x => x.Id > 5 && x.Name.Contains("Max")).Get();` Executes a query that expects to have a single object returned, rather than returning list of models it will return a single model. Specifies a key and value to be updated. Should be combined with filters/where clauses. Can be called multiple times to set multiple values. Specifies a KeyValuePair to be updated. Should be combined with filters/where clauses. Can be called multiple times to set multiple values. Calls an Update function after `Set` has been called. Executes an UPDATE query using the defined query params on the current instance. A typed response from the database. Executes an UPSERT query using the defined query params on the current instance. By default the new record is returned. Set QueryOptions.ReturnType to Minimal if you don't need this value. By specifying the QueryOptions.OnConflict parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint. QueryOptions.DuplicateResolution.IgnoreDuplicates Specifies if duplicate rows should be ignored and not inserted. Executes an UPSERT query using the defined query params on the current instance. By default the new record is returned. Set QueryOptions.ReturnType to Minimal if you don't need this value. By specifying the QueryOptions.OnConflict parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint. QueryOptions.DuplicateResolution.IgnoreDuplicates Specifies if duplicate rows should be ignored and not inserted. Client interface for Postgrest Performs a Get request, returning a which populates from the cache, if applicable. Represent a type can be used to index a collection either from the start or the end. Index is used by the C# compiler to support the new index syntax int[] someArray = new int[5] { 1, 2, 3, 4, 5 } ; int lastElement = someArray[^1]; // lastElement = 5 Construct an Index using a value and indicating if the index is from the start or from the end. The index value. it has to be zero or positive number. Indicating if the index is from the start or from the end. If the Index constructed from the end, index value 1 means pointing at the last element and index value 0 means pointing at beyond last element. Create an Index pointing at first element. Create an Index pointing at beyond last element. Create an Index from the start at the position indicated by the value. The index value from the start. Create an Index from the end at the position indicated by the value. The index value from the end. Returns the index value. Indicates whether the index is from the start or the end. Calculate the offset from the start using the giving collection length. The length of the collection that the Index will be used with. length has to be a positive value For performance reason, we don't validate the input length parameter and the returned offset value against negative values. we don't validate either the returned offset is greater than the input length. It is expected Index will be used with collections which always have non negative length/count. If the returned offset is negative and then used to index a collection will get out of range exception which will be same affect as the validation. Indicates whether the current Index object is equal to another object of the same type. An object to compare with this object Indicates whether the current Index object is equal to another Index object. An object to compare with this object Returns the hash code for this instance. Converts integer number to an Index. Converts the value of the current Index object to its equivalent string representation. Represent a range has start and end indexes. Range is used by the C# compiler to support the range syntax. int[] someArray = new int[5] { 1, 2, 3, 4, 5 }; int[] subArray1 = someArray[0..2]; // { 1, 2 } int[] subArray2 = someArray[1..^0]; // { 2, 3, 4, 5 } Represent the inclusive start index of the Range. Represent the exclusive end index of the Range. Construct a Range object using the start and end indexes. Represent the inclusive start index of the range. Represent the exclusive end index of the range. Indicates whether the current Range object is equal to another object of the same type. An object to compare with this object Indicates whether the current Range object is equal to another Range object. An object to compare with this object Returns the hash code for this instance. Converts the value of the current Range object to its equivalent string representation. Create a Range object starting from start index to the end of the collection. Create a Range object starting from first element in the collection to the end Index. Create a Range object starting from first element to the end. Calculate the start offset and length of range object using a collection length. The length of the collection that the range will be used with. length has to be a positive value. For performance reason, we don't validate the input length parameter against negative values. It is expected Range will be used with collections which always have non negative length/count. We validate the range is inside the length scope though. Helper class for parsing Select linq queries. The columns that have been selected from this linq expression. The root call that will be looped through to populate . Called like: `Table<Movies>().Select(x => new[] { x.Id, x.Name, x.CreatedAt }).Get()` A Member Node, representing a property on a BaseModel. A Unary Node, delved into to represent a property on a BaseModel. Gets a column name from property based on it's supplied attributes. Helper class for parsing Set linq queries. The column that have been selected from this linq expression. The Column's type that value should be checked against. Value to be updated. A Unary Node, delved into to represent a property on a BaseModel. A Member Node, representing a property on a BaseModel. Called when visiting a the expected new KeyValuePair(). Gets a column name from property based on it's supplied attributes. Helper class for parsing Where linq queries. The filter resulting from this Visitor, capable of producing nested filters. An entry point that will be used to populate . Invoked like: `Table<Movies>().Where(x => x.Name == "Top Gun").Get();` Called when evaluating a method A constant expression parser (i.e. x => x.Id == 5 <- where '5' is the constant) A member expression parser (i.e. => x.Id == Example.Id <- where both `x.Id` and `Example.Id` are parsed as 'members') A unary expression parser (i.e. => x.Id == 1 <- where both `1` is considered unary) An instantiated class parser (i.e. x => x.CreatedAt <= new DateTime(2022, 08, 20) <- where `new DateTime(...)` is an instantiated expression. Gets a column name (postgrest) from a Member Expression (used on BaseModel) Get the value from a MemberExpression, which includes both fields and properties. Creates map between linq and Gets arguments from a method call expression, (i.e. x => x.Name.Contains("Top")) <- where `Top` is the argument on the called method `Contains` Abstract class that must be implemented by C# Postgrest Models. Gets the values of the PrimaryKey columns (there can be multiple) on a model's instance as defined by the [PrimaryKey] attributes on a property on the model. Represents a cacheable model The stored Models Cache time in UTC. A custom resolver that handles mapping column names and property names as well as handling the conversion of Postgrest Ranges to a C# `Range`. Sets the state of the contract resolver to either insert, update, or upsert. Allow for the expression of a query filter with linq expressions. Allows the creation of a Query Filter using a LINQ expression. String value to be substituted for a null criterion Contractor to use single value filtering. Column name Operation: And, Equals, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, NotEqual, Is, Adjacent, Not, Like, ILike Constructor for Full Text Search. Column Name Operation: FTS, PHFTS, PLFTS, WFTS Constructor for Range Queries. Operator: Overlap, StrictlyLeft, StrictlyRight, NotRightOf, NotLeftOf, Adjacent Constructor to enable `AND` and `OR` Queries by allowing nested QueryFilters. Operation: And, Or Constructor to enable `NOT` functionality Operation: Not. Configuration Object for Full Text Search. API Reference: http://postgrest.org/en/v7.0.0/api.html?highlight=full%20text%20search#full-text-search Query Text Defaults to english Constructor for Full Text Search. By default the new record is returned. Set this to 'Minimal' if you don't need this value. Specifies if duplicate rows should be ignored and not inserted. Count algorithm to use to count rows in a table. If the record should be upserted /// By specifying the onConflict query parameter, you can make UPSERT work on a column(s) that has a UNIQUE constraint. Represents a Request that is backed by a caching strategy. Handler for when Remote Models have been populated The Async action that represents the Remote Request The Postgrest Table Instance The Cache lookup key - a Base64 encoded reproducible URL for this request configuration. The Caching provider. The Models returned either by Cache Hit or Remote Response The response (if applicable) from If the cache was hit for this request. If the response was stored in cache. The stored cache time in UTC. Invoked when Remote Models have been populated on this object. Constructs a Cache Backed Request that automatically populates itself using the Cache provider (if possible). Attempts to load a model from the cache. Invokes the stored Caches a modeled response using the Raises a property change event. Sets a field within this instance and raises A wrapper class from which all Responses derive. A representation of a successful Postgrest response that transforms the string response into a C# Modelled response. The first model in the response. A list of models in the response. Class created from a model derived from `BaseModel` that can generate query requests to a Postgrest Endpoint. Representative of a `USE $TABLE` command. Model derived from `BaseModel`. Typically called from the Client `new Client.Table<ModelType>` Api Endpoint (ex: "http://localhost:8000"), no trailing slash required. Optional client configuration. Generates the encoded URL with defined query parameters that will be sent to the Postgrest API. Transforms an object into a string mapped list/dictionary using `JsonSerializerSettings`. Transforms the defined filters into the expected Postgrest format. See: http://postgrest.org/en/v7.0.0/api.html#operators Performs an INSERT Request. Represents a table constructed with a Represents a caching provider to be used with Get Requests. Slices the specified array using the specified range.