Skip to content

Commit

Permalink
remove async from build action
Browse files Browse the repository at this point in the history
  • Loading branch information
juliano committed Sep 29, 2023
1 parent 36a0491 commit 404b1ac
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 183 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
fail-fast: false
matrix:
scala: [2.12.x, 2.13.x, 3.3.x]
module: [base, db, async, codegen, bigdata]
module: [base, db, codegen, bigdata]
include:
- scala: 2.12.x
scala_short: 212
Expand All @@ -40,8 +40,6 @@ jobs:
# For now, only do the `base` build for Scala 3
- scala: 3.3.x
module: db
- scala: 3.3.x
module: async
- scala: 3.3.x
module: codegen
- scala: 3.3.x
Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ docker-compose run --rm sbt sbt "test-only io.getquill.context.sql.SqlQuerySpec"

Run all tests in specific sub-project:
```bash
docker-compose run --rm sbt sbt "project quill-async" test
docker-compose run --rm sbt sbt "project quill-jdbc-zio" test
```

Run specific test in specific sub-project:
Expand Down
175 changes: 0 additions & 175 deletions docs/contexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -1023,181 +1023,6 @@ ctx.dataSource.portNumber=1521
ctx.dataSource.serverName=host
```

## NDBC Context

Async support via [NDBC driver](https://ndbc.io/) is available with Postgres database.

### quill-ndbc-postgres

#### transactions

Transaction support is provided out of the box by NDBC:

```scala
ctx.transaction {
ctx.run(query[Person].delete)
// other transactional code
}
```

The body of transaction can contain calls to other methods and multiple run calls since the transaction is automatically handled.

#### sbt dependencies

```
libraryDependencies ++= Seq(
"io.getquill" %% "quill-ndbc-postgres" % "@VERSION@"
)
```

#### context definition
```scala
lazy val ctx = new NdbcPostgresContext(Literal, "ctx")
```

#### application.properties
```
ctx.ndbc.dataSourceSupplierClass=io.trane.ndbc.postgres.netty4.DataSourceSupplier
ctx.ndbc.host=host
ctx.ndbc.port=1234
ctx.ndbc.user=root
ctx.ndbc.password=root
ctx.ndbc.database=database
```

## quill-async

The `quill-async` module provides simple async support for MySQL and Postgres databases.

#### transactions

The async module provides transaction support based on a custom implicit execution context:

```
ctx.transaction { implicit ec =>
ctx.run(query[Person].delete)
// other transactional code
}
```

The body of `transaction` can contain calls to other methods and multiple `run` calls, but the transactional code must be done using the provided implicit execution context. For instance:

```
def deletePerson(name: String)(implicit ec: ExecutionContext) =
ctx.run(query[Person].filter(_.name == lift(name)).delete)
ctx.transaction { implicit ec =>
deletePerson("John")
}
```

Depending on how the main execution context is imported, it is possible to produce an ambiguous implicit resolution. A way to solve this problem is shadowing the multiple implicits by using the same name:

```
import scala.concurrent.ExecutionContext.Implicits.{ global => ec }
def deletePerson(name: String)(implicit ec: ExecutionContext) =
ctx.run(query[Person].filter(_.name == lift(name)).delete)
ctx.transaction { implicit ec =>
deletePerson("John")
}
```

Note that the global execution context is renamed to ec.

#### application.properties

##### connection configuration
```
ctx.host=host
ctx.port=1234
ctx.user=root
ctx.password=root
ctx.database=database
```

or use connection URL with database-specific scheme (see below):

```
ctx.url=scheme://host:5432/database?user=root&password=root
```

##### connection pool configuration
```
ctx.poolMaxQueueSize=4
ctx.poolMaxObjects=4
ctx.poolMaxIdle=999999999
ctx.poolValidationInterval=10000
```

Also see [`PoolConfiguration` documentation](https://github.com/mauricio/postgresql-async/blob/master/db-async-common/src/main/scala/com/github/mauricio/async/db/pool/PoolConfiguration.scala).

##### SSL configuration
```
ctx.sslmode=disable # optional, one of [disable|prefer|require|verify-ca|verify-full]
ctx.sslrootcert=./path/to/cert/file # optional, required for sslmode=verify-ca or verify-full
```

##### other
```
ctx.charset=UTF-8
ctx.maximumMessageSize=16777216
ctx.connectTimeout=5s
ctx.testTimeout=5s
ctx.queryTimeout=10m
```

### quill-async-mysql

#### sbt dependencies

```
libraryDependencies ++= Seq(
"io.getquill" %% "quill-async-mysql" % "@VERSION@"
)
```

#### context definition
```scala
lazy val ctx = new MysqlAsyncContext(SnakeCase, "ctx")
```

#### application.properties

See [above](#applicationproperties-5)

For `url` property use `mysql` scheme:

```
ctx.url=mysql://host:3306/database?user=root&password=root
```

### quill-async-postgres

#### sbt dependencies

```
libraryDependencies ++= Seq(
"io.getquill" %% "quill-async-postgres" % "@VERSION@"
)
```

#### context definition
```scala
lazy val ctx = new PostgresAsyncContext(SnakeCase, "ctx")
```

#### application.properties

See [common properties](#applicationproperties-5)

For `url` property use `postgresql` scheme:

```
ctx.url=postgresql://host:5432/database?user=root&password=root
```

## quill-doobie

Quill 3.16.5 and above supports Doobie starting 1.0.0-RC1. You can use quill quotes to construct `ConnectionIO` programs.
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_label: "Getting Started"
Quill has integrations with many libraries. If you are using a regular RDBMS e.g. PostgreSQL
and want to use Quill to query it with an asynchronous, non-blocking, reactive application, the easiest way to get
started is by using an awesome library called ZIO.
started is by using ZIO.

A simple ZIO + Quill application looks like this:
```scala
Expand Down
2 changes: 1 addition & 1 deletion docs/quill-vs-slick.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The feedback cycle using Slick is typically longer. Some factors like normalizat

## Non-blocking IO ##

Slick provides an asynchronous wrapper on top of jdbc's blocking interface, making it harder to scale applications using it. On the other hand, quill provides fully asynchronous non-blocking database access through quill-async and quill-finagle-mysql.
Slick provides an asynchronous wrapper on top of jdbc's blocking interface, making it harder to scale applications using it. On the other hand, quill provides fully asynchronous non-blocking database access through quill-zio.

## Extensibility ##

Expand Down
3 changes: 1 addition & 2 deletions docs/writing-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -2039,8 +2039,7 @@ case class Book(id: Int, notes: List[String], pages: Vector[Int], history: Seq[D
ctx.run(query[Book])
// SELECT x.id, x.notes, x.pages, x.history FROM Book x
```
Note that not all drivers/databases provides such feature hence only `PostgresJdbcContext` and
`PostgresAsyncContext` support SQL Arrays.
Note that not all drivers/databases provides such feature hence only `PostgresJdbcContext` support SQL Arrays.


## Cassandra-specific encoding
Expand Down

0 comments on commit 404b1ac

Please sign in to comment.