1#![allow(private_bounds)]
2#![doc = include_str!("../README.md")]
3
4extern crate self as rust_query;
5
6mod aggregate;
7mod alias;
8mod ast;
9mod client;
10mod db;
11mod dummy;
12mod exec;
13mod hash;
14mod insert;
15mod migrate;
16mod mymap;
17mod pragma;
18mod ref_cast_impl;
19mod rows;
20mod token;
21mod transaction;
22mod value;
23
24pub use crate::dummy::Dummy;
25pub use aggregate::aggregate;
26pub use db::TableRow;
27use hash::TypBuilder;
28use ref_cast::RefCast;
29pub use rows::Rows;
30pub use rust_query_macros::FromDummy;
31pub use token::LocalClient;
32pub use transaction::{Database, Transaction, TransactionMut, TransactionWeak};
33pub use value::{Column, IntoColumn, UnixEpoch};
34
35pub mod args {
39 pub use crate::aggregate::Aggregate;
40 pub use crate::exec::Query;
41}
42
43pub mod migration {
47 pub use crate::migrate::{Alter, Config, Create, Migrator, NoTable};
48 pub use expect_test::expect;
49 pub use rust_query_macros::schema;
50}
51
52#[doc(hidden)]
55pub mod private {
56 pub use crate::db::Col;
57 pub use crate::dummy::{Cached, Cacher, Dummy, Row};
58 pub use crate::exec::show_sql;
59 pub use crate::hash::TypBuilder;
60 pub use crate::hash::{hash_schema, KangarooHasher};
61 pub use crate::insert::{Reader, Writable};
62 pub use crate::migrate::{
63 Migration, Schema, SchemaBuilder, TableCreation, TableMigration, TableTypBuilder, C, M,
64 };
65 pub use crate::value::{MyTyp, Typed, ValueBuilder};
66
67 pub use expect_test::Expect;
68 pub use ref_cast::RefCast;
69 pub use sea_query::SimpleExpr;
70}
71
72pub trait Table: Sized + 'static {
76 #[doc(hidden)]
79 type Ext<T>: RefCast<From = T>;
80
81 type Schema;
83
84 fn join<'inner>(rows: &mut Rows<'inner, Self::Schema>) -> Column<'inner, Self::Schema, Self> {
86 rows.join()
87 }
88
89 type Dummy<'t>;
91
92 fn dummy<'t>(val: impl IntoColumn<'t, Self::Schema, Typ = Self>) -> Self::Dummy<'t>;
105
106 type Referer;
108
109 #[doc(hidden)]
110 fn get_referer_unchecked() -> Self::Referer;
111
112 #[doc(hidden)]
114 fn name(&self) -> String {
115 Self::NAME.to_owned()
116 }
117 #[doc(hidden)]
118 fn typs(f: &mut TypBuilder<Self::Schema>);
119
120 #[doc(hidden)]
121 const ID: &'static str = "";
122 #[doc(hidden)]
123 const NAME: &'static str = "";
124}
125
126#[test]
127fn compile_tests() {
128 let t = trybuild::TestCases::new();
129 t.compile_fail("tests/compile/*.rs");
130 t.pass("examples/*.rs");
131}