Skip to content

Commit 88917ab

Browse files
committed
Added rorm-lib from main branch of rorm
0 parents  commit 88917ab

File tree

7 files changed

+2485
-0
lines changed

7 files changed

+2485
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
target/
3+
Cargo.lock

Cargo.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[package]
2+
name = "rorm-lib"
3+
version = "0.2.0"
4+
edition = "2021"
5+
keywords = ["database", "library"]
6+
authors = ["myOmikron <git@omikron.dev>"]
7+
categories = ["database", "development-tools.categories.ffi"]
8+
repository = "https://github.com/myOmikron/drorm"
9+
homepage = "https://rorm.rs"
10+
documentation = "https://docs.rorm.rs"
11+
license = "MIT"
12+
description = "The FFI bindings to C."
13+
14+
[lib]
15+
name = "rorm"
16+
crate-type = ["staticlib", "cdylib"]
17+
18+
[dependencies]
19+
rorm-db = { version = "~0.2", path = "../rorm-db" }
20+
21+
# Runtime to execute the async context in
22+
tokio = { version = "^1.21" }
23+
24+
# Async wrapper
25+
futures = { version = "^0.3" }
26+
27+
# SQLX is only needed for error unwrapping
28+
sqlx = { version = "^0.6" }
29+
30+
# Date and time library
31+
chrono = { version = "^0.4" }
32+
33+
[features]
34+
default = [
35+
"rorm-db/tokio-rustls",
36+
"tokio/rt-multi-thread",
37+
]

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# rorm-lib
2+
3+
`rorm-lib` provides FFI bindings for `rorm-db`.
4+
5+
With the help of this crate, it is possible for other languages to use the orm.
6+
7+
To provide a similar experience as `rorm` for users, it is required to build
8+
an additional layer upon this binding as well as an interface for `rorm-cli`.

src/errors.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
use crate::FFIString;
2+
3+
/**
4+
Representation of all error codes.
5+
*/
6+
#[repr(C)]
7+
#[derive(Debug)]
8+
pub enum Error<'a> {
9+
/// Everything's fine, nothing to worry about.
10+
NoError,
11+
/// Runtime was destroyed or never created and can therefore not be accessed.
12+
MissingRuntimeError,
13+
/// An error occurred while getting or accessing the runtime.
14+
RuntimeError(FFIString<'a>),
15+
/// An error occurred while trying to convert a FFIString into a &str due to invalid content
16+
InvalidStringError,
17+
/// Configuration error
18+
ConfigurationError(FFIString<'a>),
19+
/// Database error
20+
DatabaseError(FFIString<'a>),
21+
/// There are no rows left in the stream
22+
NoRowsLeftInStream,
23+
/// Column could not be converted in the given type
24+
ColumnDecodeError,
25+
/// Column was not found in row
26+
ColumnNotFoundError,
27+
/// The index in the row was out of bounds
28+
ColumnIndexOutOfBoundsError,
29+
/// The provided date could not be parsed
30+
InvalidDateError,
31+
/// The provided time could not be parsed
32+
InvalidTimeError,
33+
/// The provided datetime could not be parsed
34+
InvalidDateTimeError,
35+
}

0 commit comments

Comments
 (0)