1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
//! <div align="center">
//!
//! <img src="https://raw.githubusercontent.com/SeaQL/seaography/main/docs/Seaography.png" width="280" alt="Seaography logo"/>
//!
//! <p>
//! <strong>🧠A GraphQL framework and code generator for SeaORM</strong>
//! </p>
//!
//! [![crate](https://img.shields.io/crates/v/seaography.svg)](https://crates.io/crates/seaography)
//! [![docs](https://docs.rs/seaography/badge.svg)](https://docs.rs/seaography)
//! [![build status](https://github.com/SeaQL/seaography/actions/workflows/tests.yaml/badge.svg)](https://github.com/SeaQL/seaography/actions/workflows/tests.yaml)
//!
//! </div>
//!
//! # Seaography
//!
//! #### Seaography is a GraphQL framework for building GraphQL resolvers using SeaORM entities. It ships with a CLI tool that can generate ready-to-compile Rust GraphQL servers from existing MySQL, Postgres and SQLite databases.
//!
//! ## Benefits
//!
//! * Quick and easy to get started
//! * Generates readable code
//! * Extensible project structure
//! * Based on popular async libraries: [async-graphql](https://github.com/async-graphql/async-graphql) and [SeaORM](https://github.com/SeaQL/sea-orm)
//!
//! ## Features
//!
//! * Relational query (1-to-1, 1-to-N)
//! * Pagination for queries and relations (1-N)
//! * Filtering with operators (e.g. gt, lt, eq)
//! * Order by any column
//! * Guard fields, queries or relations
//! * Rename fields
//! * Mutations (create, update, delete)
//!
//! (Right now there is no mutation, but it's on our plan!)
//!
//! ## SeaORM Version Compatibility
//!
//! | Seaography | SeaORM |
//! |----------------------------------------------------------|-------------------------------------------------------|
//! | [0.12](https://crates.io/crates/seaography/0.12.0) | [0.12](https://crates.io/crates/sea-orm/0.12.14) |
//! | [0.3](https://crates.io/crates/seaography/0.3.0) | [0.10](https://crates.io/crates/sea-orm/0.10.7) |
//!
//! ## Quick start - ready to serve in 3 minutes!
//!
//! ### Install
//!
//! ```sh
//! cargo install sea-orm-cli@^0.12 # used to generate entities
//! cargo install seaography-cli@^1.0.0-rc.2
//! ```
//!
//! ### MySQL
//!
//! Setup the [sakila](https://github.com/SeaQL/seaography/blob/main/examples/mysql/sakila-schema.sql) sample database.
//!
//! ```sh
//! cd examples/mysql
//! sea-orm-cli generate entity -o src/entities -u mysql://user:pw@127.0.0.1/sakila --seaography
//! seaography-cli ./ src/entities mysql://user:pw@127.0.0.1/sakila seaography-mysql-example
//! cargo run
//! ```
//!
//! Go to http://localhost:8000/ and try out the following queries:
//!
//! #### Fetch films and their actors
//!
//! ```graphql
//! {
//! film(pagination: { page: { limit: 10, page: 0 } }, orderBy: { title: ASC }) {
//! nodes {
//! title
//! description
//! releaseYear
//! actor {
//! nodes {
//! firstName
//! lastName
//! }
//! }
//! }
//! }
//! }
//! ```
//!
//! #### Fetch store and its employee
//!
//! ```graphql
//! {
//! store(filters: { storeId: { eq: 1 } }) {
//! nodes {
//! storeId
//! address {
//! address
//! address2
//! }
//! staff {
//! firstName
//! lastName
//! }
//! }
//! }
//! }
//! ```
//!
//! ### Fetch inactive customers with pagination
//!
//! ```graphql
//! {
//! customer(
//! filters: { active: { eq: 0 } }
//! pagination: { page: { page: 2, limit: 3 } }
//! ) {
//! nodes {
//! customerId
//! lastName
//! email
//! }
//! paginationInfo {
//! pages
//! current
//! }
//! }
//! }
//! ```
//!
//! ### The query above using cursor pagination
//!
//! ```graphql
//! {
//! customer(
//! filters: { active: { eq: 0 } }
//! pagination: { cursor: { limit: 3, cursor: "Int[3]:271" } }
//! ) {
//! nodes {
//! customerId
//! lastName
//! email
//! }
//! pageInfo {
//! hasPreviousPage
//! hasNextPage
//! endCursor
//! }
//! }
//! }
//! ```
//!
//! ### Complex query with filters on relations
//!
//! Find all inactive customers, include their address, and their payments with amount greater than 7 ordered by amount the second result
//!
//! ```graphql
//! {
//! customer(
//! filters: { active: { eq: 0 } }
//! pagination: { cursor: { limit: 3, cursor: "Int[3]:271" } }
//! ) {
//! nodes {
//! customerId
//! lastName
//! email
//! address {
//! address
//! }
//! payment(
//! filters: { amount: { gt: "7" } }
//! orderBy: { amount: ASC }
//! pagination: { page: { limit: 1, page: 1 } }
//! ) {
//! nodes {
//! paymentId
//! amount
//! }
//! paginationInfo {
//! pages
//! current
//! }
//! pageInfo {
//! hasPreviousPage
//! hasNextPage
//! }
//! }
//! }
//! pageInfo {
//! hasPreviousPage
//! hasNextPage
//! endCursor
//! }
//! }
//! }
//! ```
//!
//! ### Filter using enumeration
//! ```graphql
//! {
//! film(
//! filters: { rating: { eq: NC17 } }
//! pagination: { page: { page: 1, limit: 5 } }
//! ) {
//! nodes {
//! filmId
//! rating
//! }
//! }
//! }
//! ```
//!
//! ### Postgres
//!
//! Setup the [sakila](https://github.com/SeaQL/seaography/blob/main/examples/postgres/sakila-schema.sql) sample database.
//!
//! ```sh
//! cd examples/postgres
//! sea-orm-cli generate entity -o src/entities -u postgres://user:pw@localhost/sakila --seaography
//! seaography-cli ./ src/entities postgres://user:pw@localhost/sakila seaography-postgres-example
//! cargo run
//! ```
//!
//! ### SQLite
//!
//! ```sh
//! cd examples/sqlite
//! sea-orm-cli generate entity -o src/entities -u sqlite://sakila.db --seaography
//! seaography-cli ./ src/entities sqlite://sakila.db seaography-sqlite-example
//! cargo run
//! ```
//!
//! ## Contribution
//!
//! Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
//!
//! Seaography is a community driven project. We welcome you to participate, contribute and together build for Rust's future.
pub use heck;
pub use itertools;
pub mod inputs;
pub use inputs::*;
pub mod outputs;
pub use outputs::*;
pub mod enumerations;
pub use enumerations::*;
pub mod utilities;
pub use utilities::*;
pub mod query;
pub use query::*;
pub mod mutation;
pub use mutation::*;
pub mod builder_context;
pub use builder_context::*;
pub mod builder;
pub use builder::*;
pub mod error;
pub use error::*;
pub type SimpleNamingFn = Box<dyn Fn(&str) -> String + Sync + Send>;
pub type ComplexNamingFn = Box<dyn Fn(&str, &str) -> String + Sync + Send>;