5 releases
Uses old Rust 2015
0.1.4 | Oct 31, 2017 |
---|---|
0.1.3 | Sep 27, 2017 |
0.1.2 | Aug 30, 2017 |
0.1.1 | Aug 26, 2017 |
0.1.0 | Jul 30, 2017 |
#1881 in Database interfaces
Used in philec
210KB
4K
SLoC
PHiLe
The Painless High-Level Persistence Engine
What's PHiLe?
PHiLe (pronounced fillet), the Painless High‑Level Persistence Engine, is a next‑generation database management tool and domain‑specific language. It allows application developers to write what is basically a textual form of a conceptual or entity relationship model, from which it automatically generates a Database Abstraction Layer.
Unlike traditional ORMs, it has a strong, expressive type system. It allows programmers to work with many kinds of values, not only objects, therefore trivially eliminating many of the bottlenecks commonly associated with ORM solutions, such as having to retrieve the transitive closure of an object, only to discard all but a few of its scalar attributes.
PHiLe also supports a wide spectrum of different languages and databases, therefore it cooperates well with many already-existing technology stacks. It includes tools for automatically migrating data of the same conceptual schema between different underlying database engines, and another DSL for refactoring the schema without loss of data or type safety.
Where can I download it?
-
PHiLe is on crates.io. You can install the compiler by issuing the following command:
cargo install philec
If you want to use the
libphile
library programmatically, add this to yourCargo.toml
:[dependencies] phile = "0.1.4"
-
You can clone the source at the official GitHub page of the project using:
git clone git://github.com/H2CO3/PHiLe.git
Is it documented?
Sure! Depending on how you are willing to use PHiLe, you may be looking for…
- The Tutorial. This gets you started quickly and painlessly with writing schemas and queries in PHiLe's domain-specific language.
- The Examples. Check out these code snippets if you learn easier by example.
- The Reference. Search through this document if you are already familiar with the basics and you are now looking for the details of a specific feature.
- API documentation for the
phile
library, useful when you want to embed PHiLe into your own Rust programs. - Manpage-style docs for
philec
, if you want to deep dive into the invocation of the PHiLe CLI compiler.
How does it work?
The philosophy behind the design of PHiLe is explained in detail on my blog.
The PHiLe DSL is a statically‑typed, object-oriented, functional-declarative language, which is capable of describing schemas (like a DDL) and queries/updates (like a DML). It brings the memory model that programmers are familiar with to the world of persistent storage: relational tables become classes or structs, records and documents become objects, and relationships become arrays and pointers.
As rightfully expected from a modern functional language, the PHiLe DSL supports advanced and convenient features such as higher‑order functions, pattern matching, and algebraic data types (including class, struct, tuple, enum and optional types). Enums, in particular, are a type‑safe alternative to stringly‑typed fields, while proper optional types prevent errors related to NULL
values.
PHiLe will support the following database flavors and programming languages:
Database Engines:- SQLite3
- MySQL / MariaDB
- MongoDB
- Rust
- C
- C++
- Objective‑C
- Swift
- Go
- JavaScript
- Python
- Ruby
- Java
- C#
- Haskell
Support for other popular storage engines (e.g. Postgres, MS/SQL, Redis, …) and programming languages would be nice and is planned.
I want to yell at you because it's crap!
- Tweet to me @H2CO3_iOS
- Open an issue on GitHub
- Leave a comment on my blog
- Mail me at h2co3@h2co3.org
Dependencies
~3.5MB
~77K SLoC