Simplify PgConnection import.
This commit is contained in:
@@ -14,7 +14,7 @@ assumptions about a microservice:
|
|||||||
`write_file` function, and a database ORM `connection`.
|
`write_file` function, and a database ORM `connection`.
|
||||||
3. All microservices must communicate with the shared PostgreSQL database via
|
3. All microservices must communicate with the shared PostgreSQL database via
|
||||||
an ORM connection passed into `process`.
|
an ORM connection passed into `process`.
|
||||||
- Rust microservices use `diesel::pg::PgConnection`.
|
- Rust microservices use `diesel::PgConnection`.
|
||||||
- Python microservices use `sqlalchemy.engine.base.Connection`.
|
- Python microservices use `sqlalchemy.engine.base.Connection`.
|
||||||
3. The `process` function returns a set of IDs (also `u64`) that are the result
|
3. The `process` function returns a set of IDs (also `u64`) that are the result
|
||||||
of processing the incoming request. Each of these IDs is also associated
|
of processing the incoming request. Each of these IDs is also associated
|
||||||
@@ -134,7 +134,7 @@ Linux wheel covers all CPython versions ≥ 3.8.
|
|||||||
|
|
||||||
```rust
|
```rust
|
||||||
use slingshot_microservice::Microservice;
|
use slingshot_microservice::Microservice;
|
||||||
use diesel::pg::PgConnection;
|
use diesel::PgConnection;
|
||||||
use slingshot_microservice::{AnyError, ReadFileFn, WriteFileFn};
|
use slingshot_microservice::{AnyError, ReadFileFn, WriteFileFn};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ Within each `process` pass:
|
|||||||
returns an opened local file handle for writing, staging the output for
|
returns an opened local file handle for writing, staging the output for
|
||||||
`s3://{resolved_bucket}/{id}`.
|
`s3://{resolved_bucket}/{id}`.
|
||||||
3. `connection` is an ORM-backed PostgreSQL connection passed into `process`
|
3. `connection` is an ORM-backed PostgreSQL connection passed into `process`
|
||||||
(`diesel::pg::PgConnection` in Rust, `sqlalchemy.engine.base.Connection`
|
(`diesel::PgConnection` in Rust, `sqlalchemy.engine.base.Connection`
|
||||||
in Python).
|
in Python).
|
||||||
4. After `process` returns, opened files are closed.
|
4. After `process` returns, opened files are closed.
|
||||||
5. Then staged write files are uploaded to S3 with the AWS SDK, local staged
|
5. Then staged write files are uploaded to S3 with the AWS SDK, local staged
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use slingshot_microservice::{AnyError, Microservice, ReadFileFn, WriteFileFn};
|
use slingshot_microservice::{AnyError, Microservice, ReadFileFn, WriteFileFn};
|
||||||
use diesel::pg::PgConnection;
|
use diesel::PgConnection;
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
fn process(
|
fn process(
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ use aws_sdk_s3::Client;
|
|||||||
use aws_sdk_s3::config::{Credentials, Region};
|
use aws_sdk_s3::config::{Credentials, Region};
|
||||||
use aws_sdk_s3::primitives::ByteStream;
|
use aws_sdk_s3::primitives::ByteStream;
|
||||||
use diesel::Connection as DieselConnection;
|
use diesel::Connection as DieselConnection;
|
||||||
use diesel::pg::PgConnection;
|
use diesel::PgConnection;
|
||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
use lapin::options::{
|
use lapin::options::{
|
||||||
BasicAckOptions, BasicConsumeOptions, BasicNackOptions, BasicPublishOptions,
|
BasicAckOptions, BasicConsumeOptions, BasicNackOptions, BasicPublishOptions,
|
||||||
|
|||||||
Reference in New Issue
Block a user