mirror of
https://github.com/Diggsey/sqlxmq.git
synced 2024-11-25 09:41:01 +00:00
Various superficial improvements
This commit is contained in:
parent
4edf49255e
commit
a02cc97e09
5 changed files with 30 additions and 6 deletions
|
@ -1,12 +1,13 @@
|
||||||
[package]
|
[package]
|
||||||
name = "sqlxmq"
|
name = "sqlxmq"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
authors = ["Diggory Blake <diggsey@googlemail.com>"]
|
authors = ["Diggory Blake <diggsey@googlemail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
repository = "https://github.com/Diggsey/sqlxmq"
|
repository = "https://github.com/Diggsey/sqlxmq"
|
||||||
description = "A reliable job queue using PostgreSQL as a backing store"
|
description = "A reliable job queue using PostgreSQL as a backing store"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
documentation = "https://docs.rs/sqlxmq"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["sqlxmq_macros"]
|
members = ["sqlxmq_macros"]
|
||||||
|
|
17
README.md
17
README.md
|
@ -1,5 +1,9 @@
|
||||||
# sqlxmq
|
# sqlxmq
|
||||||
|
|
||||||
|
[![CI Status](https://github.com/Diggsey/sqlxmq/workflows/CI/badge.svg)](https://github.com/Diggsey/sqlxmq/actions?query=workflow%3ACI)
|
||||||
|
[![Documentation](https://docs.rs/sqlxmq/badge.svg)](https://docs.rs/sqlxmq)
|
||||||
|
[![crates.io](https://img.shields.io/crates/v/sqlxmq.svg)](https://crates.io/crates/sqlxmq)
|
||||||
|
|
||||||
A job queue built on `sqlx` and `PostgreSQL`.
|
A job queue built on `sqlx` and `PostgreSQL`.
|
||||||
|
|
||||||
This library allows a CRUD application to run background jobs without complicating its
|
This library allows a CRUD application to run background jobs without complicating its
|
||||||
|
@ -104,6 +108,15 @@ present in other job queues.
|
||||||
|
|
||||||
# Getting started
|
# Getting started
|
||||||
|
|
||||||
|
## Database schema
|
||||||
|
|
||||||
|
This crate expects certain database tables and stored procedures to exist.
|
||||||
|
You can copy the migration files from this crate into your own migrations
|
||||||
|
folder.
|
||||||
|
|
||||||
|
All database items created by this crate are prefixed with `mq`, so as not
|
||||||
|
to conflict with your own schema.
|
||||||
|
|
||||||
## Defining jobs
|
## Defining jobs
|
||||||
|
|
||||||
The first step is to define a function to be run on the job queue.
|
The first step is to define a function to be run on the job queue.
|
||||||
|
@ -167,8 +180,8 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
The final step is to actually run a job.
|
The final step is to actually run a job.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
example_job.new()
|
example_job.builder()
|
||||||
// This is where we override job configuration
|
// This is where we can override job configuration
|
||||||
.set_channel_name("bar")
|
.set_channel_name("bar")
|
||||||
.set_json("John")
|
.set_json("John")
|
||||||
.spawn(&pool)
|
.spawn(&pool)
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
[package]
|
[package]
|
||||||
name = "sqlxmq_macros"
|
name = "sqlxmq_macros"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
authors = ["Diggory Blake <diggsey@googlemail.com>"]
|
authors = ["Diggory Blake <diggsey@googlemail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
repository = "https://github.com/Diggsey/sqlxmq"
|
repository = "https://github.com/Diggsey/sqlxmq"
|
||||||
description = "Procedural macros for sqlxmq"
|
description = "Procedural macros for sqlxmq"
|
||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
|
documentation = "https://docs.rs/sqlxmq"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
[lib]
|
[lib]
|
||||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -105,6 +105,15 @@
|
||||||
//!
|
//!
|
||||||
//! # Getting started
|
//! # Getting started
|
||||||
//!
|
//!
|
||||||
|
//! ## Database schema
|
||||||
|
//!
|
||||||
|
//! This crate expects certain database tables and stored procedures to exist.
|
||||||
|
//! You can copy the migration files from this crate into your own migrations
|
||||||
|
//! folder.
|
||||||
|
//!
|
||||||
|
//! All database items created by this crate are prefixed with `mq`, so as not
|
||||||
|
//! to conflict with your own schema.
|
||||||
|
//!
|
||||||
//! ## Defining jobs
|
//! ## Defining jobs
|
||||||
//!
|
//!
|
||||||
//! The first step is to define a function to be run on the job queue.
|
//! The first step is to define a function to be run on the job queue.
|
||||||
|
@ -196,7 +205,7 @@
|
||||||
//! # pool: sqlx::Pool<sqlx::Postgres>
|
//! # pool: sqlx::Pool<sqlx::Postgres>
|
||||||
//! # ) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
//! # ) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
||||||
//! example_job.builder()
|
//! example_job.builder()
|
||||||
//! // This is where we override job configuration
|
//! // This is where we can override job configuration
|
||||||
//! .set_channel_name("bar")
|
//! .set_channel_name("bar")
|
||||||
//! .set_json("John")?
|
//! .set_json("John")?
|
||||||
//! .spawn(&pool)
|
//! .spawn(&pool)
|
||||||
|
|
|
@ -27,7 +27,7 @@ impl<T: Any> DerefMut for Opaque<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A handle to a background job which will be automatically cancelled if
|
/// A handle to a background task which will be automatically cancelled if
|
||||||
/// the handle is dropped. Extract the inner join handle to prevent this
|
/// the handle is dropped. Extract the inner join handle to prevent this
|
||||||
/// behaviour.
|
/// behaviour.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
Loading…
Reference in a new issue