Module query

Source
Expand description

This module contains the QueryBuilder struct and its associated methods for building and executing SQL queries.

This module provides the functionality to construct and manipulate SQL queries for the Supabase client. It includes definitions for various query components such as filters, sorting, and the main Query structure.

§Features

  • Building complex SQL queries with ease.
  • Support for multiple types of filters and sorting orders.
  • Integration with the SupabaseClient for executing queries.

§Examples

Basic usage:

use supabase_rs::query::{Filter, Operator, Query, Sort, SortOrder};

let mut query = Query::new();
let filter = Filter {
    column: "age".to_string(),
    operator: Operator::GreaterThan,
    value: "30".to_string(),
};
let sort = Sort {
    column: "name".to_string(),
    order: SortOrder::Ascending,
};
query.add_filter(filter);
query.add_sort(sort);
let query_string = query.build();

Structs§

Filter
Represents a filter to be applied to a query, consisting of a column name, an operator, and a value to compare against.
Query
Represents a query with a collection of parameters that define specific conditions and sorting orders.
QueryBuilder
A QueryBuilder is used to construct and manage SQL queries for a specific table using a SupabaseClient.
Sort
Represents sorting criteria for query results, consisting of a column name and the order of sorting.

Enums§

Operator
Represents the type of comparison to be performed in a query filter.
SortOrder
Specifies the order in which results should be sorted.