Crate saw

Crate saw 

Source

Re-exports§

pub use saw_mcr;
pub use actix_web;
pub use tera;
pub use diesel;

Modules§

associations
Traits related to relationships between multiple tables.
ast
The AST of Tera
backend
Types which represent various database backends
body
client
Actix web async HTTP client.
connection
Types related to database connections
cookie
HTTP cookie parsing and cookie jar management.
data_types
Structs to represent the primitive equivalent of SQL types where there is no existing Rust primitive, or where using it would be confusing (such as date and time types). This module will re-export all backend specific data structures when compiled against that backend.
deserialize
Types and traits related to deserializing values from the database
dev
The actix-web prelude for library developers
dsl
Includes various helper types and bare functions which are named too generically to be included in prelude, but are often used when using Diesel.
error
Error and Result module
expression
AST types representing various typed SQL expressions.
expression_methods
Adds various methods to construct new expressions. These traits are exported by default, and implemented automatically.
guard
Route match guards.
helper_types
Provide helper types for concisely writing the return type of functions. As with iterators, it is unfortunately difficult to return a partially constructed query without exposing the exact implementation of the function. Without higher kinded types, these various DSLs can’t be combined into a single trait for boxing purposes.
helpers
Re-export some helper fns useful to write filters/fns/tests
http
Various HTTP related types
middleware
Middlewares
migration
Representation of migrations
pg
Provides types and functions related to working with PostgreSQL
prelude
Re-exports important traits and types. Meant to be glob imported when using Diesel.
query_builder
Contains traits responsible for the actual construction of SQL statements
query_dsl
Traits that construct SELECT statements
query_source
Types related to describing schema, and interactions between tables.
r2d2
Connection pooling via r2d2.
result
Errors, type aliases, and functions related to working with Result.
row
Contains the Row trait
rt
A runtime implementation that runs everything on the current thread.
serialize
Types and traits related to serializing values for the database
sql_types
Types which represent a SQL data type.
test
Various helpers for Actix applications to use during testing.
typesDeprecated
web
Essentials helper functions and types for application registration.

Macros§

allow_tables_to_appear_in_same_query
Allow two or more tables which are otherwise unrelated to be used together in a query.
diesel_infix_operator
Useful for libraries adding support for new SQL types. Apps should never need to call this.
diesel_postfix_operator
Useful for libraries adding support for new SQL types. Apps should never need to call this.
diesel_prefix_operator
Useful for libraries adding support for new SQL types. Apps should never need to call this.
impl_query_idDeprecated
Provides a standard implementation of QueryId. Apps should not need to concern themselves with this macro.
joinable
Allow two tables to be referenced in a join query without providing an explicit ON clause.
no_arg_sql_function
Declare a 0 argument SQL function for use in your code. This will generate a unit struct, which is an expression representing calling this function. See now for example output. now was generated using:
not_none
Gets the value out of an option, or returns an error.
numeric_expr
Indicates that an expression allows all numeric operators. If you create new SQL functions that return a numeric type, you should invoke this macro that type. Unfortunately, Rust disallows us from automatically implementing Add for types which implement Expression, under its orphan rules.
operator_allowed
Implements the Rust operator for a given type. If you create a new SQL function, which returns a type that you’d like to use an operator on, you should invoke this macro. Unfortunately, Rust disallows us from automatically implementing Add and other traits from std::ops, under its orphan rules.
sql_function
Declare a sql function for use in your code.
table
Specifies that a table exists, and what columns it has. This will create a new public module, with the same name, as the name of the table. In this module, you’ll find a unit struct named table, and a unit struct with the names of each of the columns.
tera_ctx
try_get_value
Helper macro to get real values out of Value while retaining proper errors in filters
unwrap_return

Structs§

App
Application builder - structure that follows the builder pattern for building application instances.
Context
The struct that holds the context of a template rendering.
HttpRequest
An HTTP Request
HttpResponse
An HTTP Response
HttpServer
An HTTP Server.
Map
Represents a JSON key/value type.
Number
Represents a JSON number, whether integer or floating point.
PgConnection
The connection string expected by PgConnection::establish should be a PostgreSQL connection string, as documented at https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNSTRING
Resource
Resource is an entry in resources table which corresponds to requested URL.
Route
Resource route definition
Scope
Resources scope.
Template
This is the parsed equivalent of a template file. It also does some pre-processing to ensure it does as little as possible at runtime Not meant to be used directly.
Tera
Main point of interaction in this library.

Enums§

ConnectionError
Errors which can occur during Connection::establish
Either
Combines two different responder types into a single type
EitherExtractError
A composite error resulting from failure to extract an Either<A, B>.
ErrorKind
The kind of an error (non-exhaustive)
Value
Represents any valid JSON value.

Traits§

AppearsOnTable
Indicates that all elements of an expression are valid given a from clause.
BelongingToDsl
Constructs a query that finds record(s) based on directional association with other record(s).
BoolExpressionMethods
Methods present on boolean expressions
BoxableExpression
Helper trait used when boxing expressions.
Column
A column on a database table. Types which implement this trait should have been generated by the table! macro.
Connection
A connection to a database
EscapeExpressionMethods
Adds the escape method to LIKE and NOT LIKE. This is used to specify the escape character for the pattern.
Expression
Represents a typed fragment of SQL.
ExpressionMethods
Methods present on all expressions, except tuples
Filter
The filter function type definition
FromRequest
Trait implemented by types that can be extracted from request.
Function
The global function type definition
GroupByDsl
This trait is not yet part of Diesel’s public API. It may change in the future without a major version bump.
GroupedBy
The grouped_by function groups records by their parent.
HttpMessage
Trait that implements general purpose operations on http messages
Identifiable
This trait indicates that a struct represents a single row in a database table.
Insertable
Represents that a structure can be used to insert a new row into the database. This is automatically implemented for &[T] and &Vec<T> for inserting more than one record.
IntoSql
Converts a type to its representation for use in Diesel’s query builder.
JoinOnDsl
Specify the ON clause for a join statement. This will override any implicit ON clause that would come from joinable!
JoinTo
Indicates that two tables can be joined without an explicit ON clause.
NullableExpressionMethods
Methods present on all expressions
OptionalExtension
See the method documentation.
PgArrayExpressionMethods
PostgreSQL specific methods present on array expressions.
PgExpressionMethods
PostgreSQL specific methods which are present on all expressions.
PgSortExpressionMethods
PostgreSQL expression methods related to sorting.
PgTextExpressionMethods
PostgreSQL specific methods present on text expressions.
PgTimestampExpressionMethods
PostgreSQL specific methods present on timestamp expressions.
QueryDsl
Methods used to construct select statements.
QuerySource
Represents a type which can appear in the FROM clause. Apps should not need to concern themselves with this trait.
Queryable
Trait indicating that a record can be queried from the database.
Responder
Trait implemented by types that can be converted to a http response.
ResponseError
Error that can be converted to Response
RunQueryDsl
Methods used to execute queries.
SaveChangesDsl
Sugar for types which implement both AsChangeset and Identifiable
SelectableExpression
Indicates that an expression can be selected from a source.
Table
A SQL database table. Types which implement this trait should have been generated by the table! macro.
Test
The tester function type definition
TextExpressionMethods
Methods present on text expressions

Functions§

Answer
debug_query
Takes a query QueryFragment expression as an argument and returns a type that implements fmt::Display and fmt::Debug to show the query.
delete
Creates a DELETE statement.
diesel_connect
diesel_pool_connect
dotted_pointer
Lookups a dotted path in a json value contrary to the json slash pointer it’s not allowed to begin with a dot
escape_html
Escape HTML following OWASP
from_value
Interpret a serde_json::Value as an instance of type T.
get_json_pointerDeprecated
Converts a dotted path to a json pointer one
insert_into
Creates an INSERT statement for the target table.
insert_or_ignore_into
Creates an INSERT [OR] IGNORE statement.
replace_into
Creates a REPLACE statement.
select
Creates a bare select statement, with no from clause. Primarily used for testing diesel itself, but likely useful for third party crates as well. The given expressions must be selectable from anywhere.
sql_query
Construct a full SQL query using raw SQL.
to_value
Convert a T into serde_json::Value which is an enum that can represent any valid JSON data.
update
Creates an UPDATE statement.

Type Aliases§

ConnectionResult
A specialized result type for establishing connections.
PgPool
QueryResult
A specialized result type for queries.
Res

Attribute Macros§

GET
POST
SERVER
connect
Creates route handler with actix_web::guard::Connect.
delete
Creates route handler with actix_web::guard::Delete.
get
Creates route handler with actix_web::guard::Get.
head
Creates route handler with actix_web::guard::Head.
main
Marks async main function as the actix system entry-point.
options
Creates route handler with actix_web::guard::Options.
patch
Creates route handler with actix_web::guard::Patch.
post
Creates route handler with actix_web::guard::Post.
put
Creates route handler with actix_web::guard::Put.
route
Creates resource handler, allowing multiple HTTP method guards.
trace
Creates route handler with actix_web::guard::Trace.

Derive Macros§

AsChangeset
AsExpression
Associations
DieselNumericOps
FromSqlRow
Identifiable
Insertable
QueryId
Queryable
QueryableByName
SqlType