52 releases (breaking)

0.71.1 Nov 17, 2024
0.71.0 Jul 27, 2024
0.70.0 Jan 10, 2024
0.68.0 Oct 31, 2023
0.9.0 Jul 26, 2019

#1223 in Database interfaces

Download history 16/week @ 2024-08-17 36/week @ 2024-08-24 69/week @ 2024-08-31 22/week @ 2024-09-07 20/week @ 2024-09-14 71/week @ 2024-09-21 60/week @ 2024-09-28 8/week @ 2024-10-05 45/week @ 2024-10-12 15/week @ 2024-10-19 11/week @ 2024-10-26 62/week @ 2024-11-02 1/week @ 2024-11-09 142/week @ 2024-11-16 47/week @ 2024-11-23 35/week @ 2024-11-30

238 downloads per month
Used in 24 crates (17 directly)

MIT license

18KB
427 lines

crates.io Build Status codecov

"A pleasure to meet you. I am C-3p0, JSON-DB Relations."

C3p0: "Hello, I don't believe we have been introduced. A pleasure to meet you. I am C-3p0, JSON-DB Relations."

Are you playing with Postgres and you like it?

Do you think JSON is excellent, but it could be better handled in your DB code?

whether you prefer rust-postgres or Diesel, C3p0 brings you a set of tools to simplify JSON integration in your database workflow.

So, if you would like to:

  • use any serde_json::Serializable struct as a valid field in your Diesel models
  • seamlessly integrate any serde_json::Serializable struct in your rust-postgres code
  • automatically upgrade your schema in rust-postgres as in Diesel migration

then keep reading!

What C3p0 is not

Even when it offers a high-level interface to perform basic CRUD operations, it is not an ORM nor an alternative to Diesel or similar products.

C3p0: "I see, Sir Luke".

Great!

How it works

C3p0 is composed of a set of independent small Rust libraries for:

  • simplifying JSON-Postgres interactions
  • facilitating general schema management

C3p0 components:

C3p0 components not ready yet:

  • c3p0_diesel This will be the equivalent c3p0_pg build on Diesel.

Prerequisites

You must have Rust version 1.33 or later installed.

History

The first C3p0 version was written in Java...

C3p0: "If I told you half the things I’ve heard about this Jabba the Hutt, you’d probably short circuit."

I said "Java", "Ja"-"va". Stay focused, please!

Anyway, Java is slowly showing its age, and we got a bit bored about it.

C3p0: "they're using a very primitive dialect".

Indeed.

On the contrary, our interest in the Rust programming language has kept growing over time; so, experimented with it and, finally, migrated some critical portions of our code to Rust.

Just said, we love it.

We believe that Rust is a better overall language.

C3p0: "The city's central computer told you?"

Yes! It allows us to achieve better resource usage, to avoid the garbage collector and the virtual machine, and, at the same time, to get a better and safer concurrency level.

Can I use it in production?

Han "Don't worry. Everything's gonna be fine. Trust me."

C3p0: "Every time he employs that phrase, my circuitry becomes erratic!"

Han: ???

C3p0: "Artoo says that the chances of survival are 725 to 1".

Dependencies

~0.8–1.7MB
~36K SLoC