Skip to content

Commit

Permalink
comments from pr
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-alfers committed Feb 1, 2024
1 parent 34e0904 commit ef1a7e3
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package akka.persistence.r2dbc
import akka.annotation.InternalApi
import akka.annotation.InternalStableApi
import akka.persistence.r2dbc.internal.codec.IdentityAdapter
import akka.persistence.r2dbc.internal.codec.PayloadCodec
import akka.persistence.r2dbc.internal.codec.SqlServerQueryAdapter
import akka.persistence.r2dbc.internal.codec.QueryAdapter
import akka.persistence.r2dbc.internal.codec.TagsCodec
Expand All @@ -18,7 +19,6 @@ import com.typesafe.config.Config
import java.util.Locale
import scala.collection.immutable
import scala.concurrent.duration._
import akka.persistence.r2dbc.internal.codec.PayloadCodec

/**
* INTERNAL API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,26 @@

package akka.persistence.r2dbc.internal.codec

trait QueryAdapter {
import akka.annotation.InternalApi

/**
* INTERNAL API
*/
@InternalApi private[akka] trait QueryAdapter {
def apply(query: String): String
}

object IdentityAdapter extends QueryAdapter {
/**
* INTERNAL API
*/
@InternalApi private[akka] object IdentityAdapter extends QueryAdapter {
override def apply(query: String): String = query
}

object SqlServerQueryAdapter extends QueryAdapter {
/**
* INTERNAL API
*/
@InternalApi private[akka] object SqlServerQueryAdapter extends QueryAdapter {
/*
* Convert a sqlserver query like
* `sql"select * from t where a=$1 and b=$2"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private[r2dbc] class PostgresDurableStateDao(
private implicit val statePayloadCodec: PayloadCodec = settings.durableStatePayloadCodec
implicit val timestampCodec: TimestampCodec = settings.timestampCodec
private implicit val tagsCodec: TagsCodec = settings.tagsCodec
implicit val queryAdapter: QueryAdapter = settings.queryAdapter
protected implicit val queryAdapter: QueryAdapter = settings.queryAdapter

// used for change events
private lazy val journalDao: JournalDao = dialect.createJournalDao(settings, connectionFactory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private[r2dbc] class PostgresQueryDao(settings: R2dbcSettings, connectionFactory
protected implicit val journalPayloadCodec: PayloadCodec = settings.journalPayloadCodec
protected implicit val timestampCodec: TimestampCodec = settings.timestampCodec
protected implicit val tagsCodec: TagsCodec = settings.tagsCodec
implicit val queryAdapter: QueryAdapter = settings.queryAdapter
protected implicit val queryAdapter: QueryAdapter = settings.queryAdapter

protected def sqlFalse: String = "false"
protected def sqlDbTimestamp = "CURRENT_TIMESTAMP"
Expand Down
2 changes: 0 additions & 2 deletions ddl-scripts/create_tables_sqlserver.sql
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,3 @@ IF NOT EXISTS(SELECT * FROM sys.indexes WHERE name = 'durable_state_slice_idx' A
BEGIN
CREATE INDEX durable_state_slice_idx ON durable_state(slice, entity_type, db_timestamp, revision);
END;

--DROP TABLE event_journal;
16 changes: 12 additions & 4 deletions docs/src/main/paradox/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ akka.persistence.r2dbc.connection-factory = {

See @ref[Configuration](config.md) for more configuration details.

#### Using H2
#### H2

The H2 dependencies are marked as `provided` dependencies of `akka-persistence-r2dbc` to not be pulled in for projects not using H2. They must be listed explicitly as dependencies in the build configuration for projects that use them. The two required artifacts are:

Expand All @@ -99,7 +99,7 @@ akka.persistence.r2dbc.connection-factory = {

See @ref[Configuration](config.md) for more configuration details.

#### Using Microsoft SQL Server
#### Microsoft SQL Server

The SQL Server dependency is marked as `provided` dependencies of `akka-persistence-r2dbc` to not be pulled in for projects not using SQL Server. It must be listed explicitly as dependencies in the build configuration for projects that use it. The required artifacts is:

Expand Down Expand Up @@ -131,16 +131,24 @@ Postgres:
Yugabyte:
: @@snip [docker-compose.yml](/docker/docker-compose-yugabyte.yml)

SQLServer:
: @@snip [docker-compose.yml](/docker/docker-compose-sqlserver.yml)

Start with:

Postgres:
: ```
docker-compose -f docker/docker-compose-postgres.yml up --wait
docker compose -f docker/docker-compose-postgres.yml up --wait
```
Yugabyte:
: ```
docker-compose -f docker/docker-compose-yugabyte.yml up
docker compose -f docker/docker-compose-yugabyte.yml up
```

SQLServer:
: ```
docker compose -f docker/docker-compose-sqlserver.yml up
```
<a id="schema"></a>
Expand Down

0 comments on commit ef1a7e3

Please sign in to comment.