This repository has been archived by the owner on Oct 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f320c0
commit c60efa1
Showing
18 changed files
with
12,289 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Dependencies | ||
/node_modules | ||
|
||
# Production | ||
/build | ||
|
||
# Generated files | ||
.docusaurus | ||
.cache-loader | ||
|
||
# Misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
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,2 +1,33 @@ | ||
# website | ||
:globe_with_meridians: Website Source | ||
# Website | ||
|
||
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator. | ||
|
||
### Installation | ||
|
||
``` | ||
$ yarn | ||
``` | ||
|
||
### Local Development | ||
|
||
``` | ||
$ yarn start | ||
``` | ||
|
||
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server. | ||
|
||
### Build | ||
|
||
``` | ||
$ yarn build | ||
``` | ||
|
||
This command generates static content into the `build` directory and can be served using any static contents hosting service. | ||
|
||
### Deployment | ||
|
||
``` | ||
$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy | ||
``` | ||
|
||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
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,3 @@ | ||
module.exports = { | ||
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], | ||
}; |
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,82 @@ | ||
--- | ||
id: getting-started | ||
title: Getting Started | ||
sidebar_label: Getting Started | ||
--- | ||
|
||
Oxidizer helps you reduce the boiler plate of writing entities, tables & migrations when using [tokio-postgres](https://crates.io/crates/tokio-postgres) and [refinery](https://crates.io/crates/refinery). | ||
|
||
:::caution | ||
|
||
Note that, while functional and working, this is in early stages. Use with caution. | ||
|
||
::: | ||
|
||
Examples: | ||
|
||
```rust | ||
#[derive(Entity)] | ||
#[derive(Default)] | ||
pub struct MyEntity { | ||
#[primary_key] | ||
id: i32, | ||
|
||
name: String, | ||
|
||
#[indexed] | ||
integer: i32, | ||
integer64: i64, | ||
|
||
float: f32, | ||
double: f64, | ||
|
||
boolean: bool, | ||
|
||
datetime: Option<DateTime<Utc>>, | ||
} | ||
``` | ||
|
||
```rust | ||
#[derive(Entity)] | ||
#[entity(table_name="custom2")] | ||
#[index(name="myindex", columns="name, datetime", unique)] | ||
#[has_many(model="TestReverseRelation", field="entity_id")] | ||
#[has_many(model="TestEntity", field="entity_id", through="TestManyToMany")] | ||
pub struct MyEntity2 { | ||
#[primary_key] | ||
id: i32, | ||
|
||
name: String, | ||
|
||
#[indexed] | ||
integer: i32, | ||
integer64: i64, | ||
|
||
float: f32, | ||
double: f64, | ||
|
||
boolean: bool, | ||
|
||
datetime: Option<DateTime<Utc>>, | ||
} | ||
``` | ||
|
||
The above will produce helper methods to read and write the entities from db. | ||
|
||
```rust | ||
use oxidizer::db::DB; | ||
|
||
... | ||
|
||
|
||
let uri = "postgres://postgres:alkje2lkaj2e@db/postgres"; | ||
let max_open = 50; // mobc | ||
let ca_file: Option<&str> = None; | ||
let db = DB::connect(&uri, max_open, ca_file).await.unwrap(); | ||
|
||
db.migrate_tables(&[MyEntity::create_migration().unwrap()]).await.unwrap(); | ||
|
||
let mut entity = MyEntity { ... }; | ||
let creating = entity.save(&db).await.unwrap(); | ||
assert_eq!(creating, true); | ||
``` |
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,93 @@ | ||
module.exports = { | ||
title: "Oxidizer", | ||
tagline: "A Rust ORM based on tokio-postgres and refinery", | ||
url: "https://oxidizer-rs.github.io", | ||
baseUrl: "/", | ||
onBrokenLinks: "throw", | ||
favicon: "img/favicon.ico", | ||
organizationName: "oxidizer-rs", // Usually your GitHub org/user name. | ||
projectName: "oxidizer-rs.github.io", // Usually your repo name. | ||
themeConfig: { | ||
colorMode: { | ||
disableSwitch: false, | ||
respectPrefersColorScheme: true, | ||
switchConfig: { | ||
darkIcon: "🌙", | ||
darkIconStyle: { | ||
marginLeft: "2px", | ||
}, | ||
lightIcon: "☀️", | ||
lightIconStyle: { | ||
marginLeft: "1px", | ||
}, | ||
}, | ||
}, | ||
prism: { | ||
theme: require("prism-react-renderer/themes/dracula"), | ||
darkTheme: require("prism-react-renderer/themes/dracula"), | ||
}, | ||
navbar: { | ||
hideOnScroll: false, | ||
title: "Oxidizer", | ||
logo: { | ||
alt: "Oxidizer Logo", | ||
src: "img/logo.svg", | ||
}, | ||
items: [ | ||
{ | ||
to: "docs", | ||
activeBasePath: "docs", | ||
label: "Docs", | ||
position: "left", | ||
}, | ||
// {to: 'blog', label: 'Blog', position: 'left'}, | ||
{ | ||
href: "https://crates.io/crates/oxidizer", | ||
label: "Crate", | ||
position: "right", | ||
}, | ||
{ | ||
href: "https://github.com/oxidizer-rs/oxidizer", | ||
label: "GitHub", | ||
position: "right", | ||
}, | ||
], | ||
}, | ||
footer: { | ||
copyright: `Copyright © ${new Date().getFullYear()} oxidizer-rs`, | ||
}, | ||
// googleAnalytics: { | ||
// trackingID: '', | ||
// anonymizeIP: true, // Should IPs be anonymized? | ||
// }, | ||
// algolia: { | ||
// apiKey: '', | ||
// indexName: 'oxidizer-rs', | ||
// }, | ||
}, | ||
plugins: ["docusaurus-plugin-sass", "@docusaurus/plugin-ideal-image"], | ||
presets: [ | ||
[ | ||
"@docusaurus/preset-classic", | ||
{ | ||
docs: { | ||
// It is recommended to set document id as docs home page (`docs/` path). | ||
homePageId: "getting-started", | ||
sidebarPath: require.resolve("./sidebars.js"), | ||
// Please change this to your repo. | ||
editUrl: | ||
"https://github.com/oxidizer-rs/oxidizer/edit/master/", | ||
}, | ||
blog: { | ||
showReadingTime: true, | ||
// Please change this to your repo. | ||
editUrl: | ||
"https://github.com/oxidizer-rs/oxidizer/edit/master/", | ||
}, | ||
theme: { | ||
customCss: require.resolve("./src/css/custom.scss"), | ||
}, | ||
}, | ||
], | ||
], | ||
}; |
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,46 @@ | ||
{ | ||
"name": "oxidizer-website", | ||
"description": "Oxidizer Website", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"docusaurus": "docusaurus", | ||
"start": "docusaurus start", | ||
"build": "docusaurus build", | ||
"swizzle": "docusaurus swizzle", | ||
"deploy": "docusaurus deploy", | ||
"serve": "docusaurus serve", | ||
"commit": "git-cz" | ||
}, | ||
"dependencies": { | ||
"@docusaurus/core": "^2.0.0-alpha.61", | ||
"@docusaurus/plugin-ideal-image": "^2.0.0-alpha.39", | ||
"@docusaurus/preset-classic": "^2.0.0-alpha.61", | ||
"@docusaurus/theme-search-algolia": "^2.0.0-alpha.32", | ||
"@mdx-js/react": "^1.5.8", | ||
"clsx": "^1.1.1", | ||
"docusaurus-plugin-sass": "^0.1.9", | ||
"react": "^16.8.4", | ||
"react-dom": "^16.8.4" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"devDependencies": { | ||
"cz-conventional-changelog": "^3.2.0" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
} | ||
} |
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,14 @@ | ||
module.exports = { | ||
docs: [ | ||
{ | ||
type: "doc", | ||
id: "getting-started", | ||
}, | ||
{ | ||
type: "category", | ||
label: "Methods", | ||
collapsed: false, | ||
items: [], | ||
}, | ||
], | ||
}; |
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,44 @@ | ||
/* stylelint-disable docusaurus/copyright-header */ | ||
/** | ||
* Any CSS included here will be global. The classic template | ||
* bundles Infima by default. Infima is a CSS framework designed to | ||
* work well for content-centric websites. | ||
*/ | ||
|
||
/* You can override the default Infima variables here. */ | ||
:root { | ||
--ifm-background-color: #fff; | ||
--ifm-background-surface-color: #f2f6fa; | ||
--ifm-color-primary: #ff6344; | ||
--ifm-color-primary-dark: #ff4824; | ||
--ifm-color-primary-darker: #ff3b14; | ||
--ifm-color-primary-darkest: #e22500; | ||
--ifm-color-primary-light: #ff7e64; | ||
--ifm-color-primary-lighter: #ff8b74; | ||
--ifm-color-primary-lightest: #ffb4a5; | ||
--ifm-card-background-color: var(--ifm-background-color); | ||
--ifm-footer-background-color: var(--ifm-background-color); | ||
} | ||
|
||
html[data-theme="dark"] { | ||
// --ifm-background-color: #242526; | ||
// --ifm-background-surface-color: #18191a; | ||
--ifm-color-primary: #ffcf5d; | ||
--ifm-color-primary-dark: #ffc53a; | ||
--ifm-color-primary-darker: #ffc029; | ||
--ifm-color-primary-darkest: #f4ab00; | ||
--ifm-color-primary-light: #ffd980; | ||
--ifm-color-primary-lighter: #ffde91; | ||
--ifm-color-primary-lightest: #ffeec5; | ||
} | ||
|
||
.docusaurus-highlight-code-line { | ||
display: block; | ||
margin: 0 calc(-1 * var(--ifm-pre-padding)); | ||
padding: 0 var(--ifm-pre-padding); | ||
background-color: rgb(72, 77, 91); | ||
|
||
html[data-theme="dark"] & { | ||
background-color: rgba(0, 0, 0, 0.3); | ||
} | ||
} |
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 @@ | ||
import React from "react"; | ||
import clsx from "clsx"; | ||
import Layout from "@theme/Layout"; | ||
import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; | ||
import styles from "./styles.module.scss"; | ||
|
||
import Features from "@theme/Features"; | ||
import Hero from "@theme/Hero"; | ||
|
||
function Home() { | ||
const context = useDocusaurusContext(); | ||
const { siteConfig = {} } = context; | ||
const { tagline } = siteConfig; | ||
|
||
return ( | ||
<Layout description={tagline}> | ||
<Hero /> | ||
|
||
<main className={styles.main}> | ||
<Features /> | ||
</main> | ||
</Layout> | ||
); | ||
} | ||
|
||
export default Home; |
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,16 @@ | ||
/* stylelint-disable docusaurus/copyright-header */ | ||
|
||
/** | ||
* CSS files with the .module.css suffix will be treated as CSS modules | ||
* and scoped locally. | ||
*/ | ||
|
||
.main { | ||
section { | ||
padding: 5rem 0; | ||
|
||
@media screen and (max-width: 996px) { | ||
padding: 2.5rem 0; | ||
} | ||
} | ||
} |
Oops, something went wrong.