Skip to content

Commit

Permalink
0.6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Mar 18, 2023
1 parent 262c65a commit 9d979fc
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 80 deletions.
130 changes: 71 additions & 59 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prisma-client-rust"
version = "0.6.5"
version = "0.6.6"
authors = ["Brendan Allan <[email protected]>"]
edition = "2021"
description = "A prisma client for Rust"
Expand All @@ -15,14 +15,14 @@ members = [
"sdk",
"sdk/example/*",
"cli",
"macros",
"macros",
"prisma-cli",
]
resolver = "2"

[features]
default = ["mysql", "sqlite", "mssql", "postgresql", "mongodb"]
rspc = ["dep:rspc"]
rspc = ["dep:rspc", "prisma-client-rust-macros"]
sqlite-create-many = ["psl/sqlite-create-many"]
migrations = ["migration-core", "include_dir", "tempdir", "tokio/fs", "tracing"]
mocking = ["tokio"]
Expand Down Expand Up @@ -66,7 +66,7 @@ base64 = "0.13.0"
tokio = { version = "1.21.0", optional = true }
futures = "0.3"
paste = "1.0.11"
prisma-client-rust-macros = { path = "./macros" }
prisma-client-rust-macros = { path = "./macros", optional = true }

query-core.workspace = true
query-connector.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="center">
<h1>Prisma Client Rust</h1>
<p><b>Type-safe database access for Rust</b></p>
<img src="https://img.shields.io/badge/latest-0.6.5-blue?style=flat-square" alt="Latest version of Prisma Client Rust is 0.6.5">
<img src="https://img.shields.io/badge/latest-0.6.6-blue?style=flat-square" alt="Latest version of Prisma Client Rust is 0.6.6">
<a href="https://prisma.io">
<img src="https://img.shields.io/static/v1?label=prisma&message=v4.8.0&color=blue&logo=prisma&style=flat-square" alt="Latest supported Prisma version is 4.8.0">
</a>
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prisma-client-rust-cli"
version = "0.6.5"
version = "0.6.6"
authors = ["Brendan Allan <[email protected]>"]
edition = "2021"
rust-version = "1.62"
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ First, the main library and CLI package must be added to your project's Cargo.to

```toml
[dependencies]
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.5" }
prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.5" }
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.6" }
prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.6" }
```

The generated client will need `serde`, so run `cargo add` to install it:
Expand Down
6 changes: 3 additions & 3 deletions examples/actix/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::Deserialize;

mod db;

use db::{user, PrismaClient};
use db::*;

#[get("/users")]
async fn get_users(client: web::Data<PrismaClient>) -> impl Responder {
Expand Down Expand Up @@ -66,10 +66,10 @@ async fn create_post(

#[actix_web::main]
async fn main() -> std::io::Result<()> {
let client = web::Data::new(db::new_client().await.unwrap());
let client = web::Data::new(PrismaClient::_builder().build().await.unwrap());

#[cfg(debug_assertions)]
client._push_db(false).await.unwrap();
client._db_push().await.unwrap();

HttpServer::new(move || {
App::new()
Expand Down
6 changes: 4 additions & 2 deletions examples/axum-rest/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
use axum::{extract::Extension, Router};
use std::sync::Arc;

use crate::db::*;

pub mod db;
pub mod routes;

#[tokio::main]
async fn main() {
let prisma_client = Arc::new(db::new_client().await.unwrap());
let prisma_client = Arc::new(PrismaClient::_builder().build().await.unwrap());

#[cfg(debug_assertions)]
prisma_client._db_push(false).await.unwrap();
prisma_client._db_push().await.unwrap();

let app = Router::new()
.nest("/api", routes::create_route())
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ pub mod db;

#[tokio::main]
pub async fn main() {
let client = new_client().await.unwrap();
let client = PrismaClient::_builder().build().await.unwrap();

#[cfg(debug_assertions)]
client._db_push(false).await.unwrap();
client._db_push().await.unwrap();

client
.user()
Expand Down
2 changes: 1 addition & 1 deletion macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prisma-client-rust-macros"
version = "0.6.5"
version = "0.6.6"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prisma-client-rust-sdk"
version = "0.6.5"
version = "0.6.6"
authors = ["Brendan Allan <[email protected]>"]
edition = "2021"
rust-version = "1.62"
Expand Down
2 changes: 1 addition & 1 deletion sdk/example/app/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[alias]
prisma = "run -p sdk-example-prisma-cli --bin prisma --"
prisma = "run -p sdk-example-prisma-cli --bin sdk-example-prisma --"
custom-generator = "run -p sdk-example-prisma-cli --bin custom-generator --"
1 change: 1 addition & 0 deletions sdk/example/generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ mongodb = ["prisma-client-rust-sdk/mongodb"]
[dependencies]
prisma-client-rust-sdk = { path = "../..", default-features = false }
serde = { version = "1.0.145", features = ["derive"] }
thiserror = "1.0.40"
11 changes: 8 additions & 3 deletions sdk/example/generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ struct ExampleGenerator {
client_path: String,
}

#[derive(thiserror::Error, serde::Serialize, Debug)]
#[error("Example Generator Error")]
struct Error;

impl PrismaGenerator for ExampleGenerator {
const NAME: &'static str = "Example Generator";
const DEFAULT_OUTPUT: &'static str = "./prisma-example-generator.rs";

type Error = ();
type Error = Error;

fn generate(self, args: GenerateArgs) -> Result<TokenStream, ()> {
fn generate(self, args: GenerateArgs) -> Result<String, Error> {
let client_path = ident(&self.client_path);

let model_impls = args.dml.models().map(|model| {
Expand Down Expand Up @@ -47,7 +51,8 @@ impl PrismaGenerator for ExampleGenerator {
use crate::#client_path as prisma;

#(#model_impls)*
})
}
.to_string())
}
}

Expand Down
File renamed without changes.

0 comments on commit 9d979fc

Please sign in to comment.