-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Representing documents using trait instead of wrapper
- Loading branch information
Showing
16 changed files
with
500 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[workspace] | ||
|
||
members = [ | ||
"ledb-types", | ||
"ledb", | ||
"ledb-actix", | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[package] | ||
name = "ledb-types" | ||
version = "0.2.0" | ||
authors = ["Kayo <kayo@illumium.org>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
repository = "https://github.com/katyo/ledb" | ||
homepage = "https://github.com/katyo/ledb/tree/master/ledb-types" | ||
keywords = ["storage", "document", "json", "cbor"] | ||
categories = ["database"] | ||
description = "Basic types for storable documents" | ||
|
||
[badges] | ||
travis-ci = { repository = "katyo/ledb" } | ||
appveyor = { repository = "katyo/ledb" } | ||
|
||
[dependencies] | ||
serde = "1" | ||
serde_derive = "1" | ||
serde_json = { version = "1", optional = true } | ||
serde_cbor = { version = "0.9", optional = true } | ||
|
||
[features] | ||
default = [] | ||
json = ["serde_json"] | ||
cbor = ["serde_cbor"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Types for defining storable documents | ||
|
||
[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) | ||
[![Travis-CI Build Status](https://travis-ci.org/katyo/ledb.svg?branch=master)](https://travis-ci.org/katyo/ledb) | ||
[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/1wrmhivii22emfxg)](https://ci.appveyor.com/project/katyo/ledb) | ||
[![Crates.io Package](https://img.shields.io/crates/v/ledb.svg?style=popout)](https://crates.io/crates/ledb) | ||
[![Docs.rs API Documentation](https://docs.rs/ledb/badge.svg)](https://docs.rs/ledb) | ||
|
||
This types and traits widely used for documents which can be managed using persistent storages like *LEDB*. | ||
|
||
The **LEDB** is an attempt to implement simple but efficient, lightweight but powerful document storage. | ||
|
||
The abbreviation *LEDB* may be treated as an Lightweight Embedded DB, also Low End DB, also Literium Engine DB, also LitE DB, and so on. | ||
|
||
## Links | ||
|
||
* [ledb-types Crate on crates.io](https://crates.io/crates/ledb-types) | ||
* [ledb-types API Docs on docs.rs](https://docs.rs/ledb-types) | ||
* [ledb Crate on crates.io](https://crates.io/crates/ledb) | ||
* [ledb API Docs on docs.rs](https://docs.rs/ledb) | ||
|
||
## Usage example | ||
|
||
```rust | ||
|
||
extern crate serde; | ||
#[macro_use] extern crate serde_derive; | ||
extern crate ledb_types; | ||
|
||
use ledb_types::{Document, Identifier, Primary}; | ||
|
||
#[derive(Serialize, Deserialize)] | ||
struct MyDoc { | ||
// define optional primary key field | ||
id: Option<Primary>, | ||
// define other fields | ||
title: String, | ||
tag: Vec<String>, | ||
timestamp: u32, | ||
} | ||
|
||
impl Document for MyDoc { | ||
// declare primary key field name | ||
fn primary_field() -> Identifier { | ||
"id".into() | ||
} | ||
} | ||
``` |
Oops, something went wrong.