Open adrianfilip opened 2 years ago
[ ] Add a new project -- Example: https://github.com/zio/zio-connect/blob/2507925dcd9acf5cb1dbb5e004afef3982ad6807/build.sbt#L38
[ ] Create the following directory structure
zio.connect.redis
[ ] Create the connector
sealed trait RedisConnector
case class LiveRedisConnector() extends RedisConnector { ... }
object LiveRedisConnector { val layer: ZLayer[???, ???, RedisConnector] = { ... LiveRedisConnector(...) }
}
[ ] Provide accessors in the package object Example: https://github.com/zio/zio-connect/blob/master/connectors/file-connector/src/main/scala/zio/connect/file/package.scala
[ ] Tests belong in the RedisConnectorSpec file. They use the accessors. Example:- https://github.com/zio/zio-connect/blob/master/connectors/file-connector/src/test/scala/zio/connect/file/FileConnectorSpec.scala
[ ] There will be a LiveRedisConnectorSpec that runs the RedisConnectorSpec files for the LiveRedisConnector layer You can use testcontainers - maybe this one https://github.com/redis-developer/testcontainers-redis Example with testcontainers and localstack S3 here - https://github.com/zio/zio-connect/pull/83/files#diff-e7e0899e455a741a644a05c0b26879d176a9126951477cd7c62dc19ade98b5cc
[ ] Provide a TestRedisConnector layer that allows testing with a stub. Example - https://github.com/zio/zio-connect/blob/master/connectors/file-connector/src/main/scala/zio/connect/file/TestFileConnector.scala
Great. Thanks Adrian!
Thanks for picking this up. Added some general guidelines.
Steps
[ ] Add a new project -- Example: https://github.com/zio/zio-connect/blob/2507925dcd9acf5cb1dbb5e004afef3982ad6807/build.sbt#L38
[ ] Create the following directory structure
[ ] Create the connector
sealed trait RedisConnector
case class LiveRedisConnector() extends RedisConnector { ... }
object LiveRedisConnector { val layer: ZLayer[???, ???, RedisConnector] = { ... LiveRedisConnector(...) }
}
[ ] Provide accessors in the package object Example: https://github.com/zio/zio-connect/blob/master/connectors/file-connector/src/main/scala/zio/connect/file/package.scala
[ ] Tests belong in the RedisConnectorSpec file. They use the accessors. Example:- https://github.com/zio/zio-connect/blob/master/connectors/file-connector/src/test/scala/zio/connect/file/FileConnectorSpec.scala
[ ] There will be a LiveRedisConnectorSpec that runs the RedisConnectorSpec files for the LiveRedisConnector layer You can use testcontainers - maybe this one https://github.com/redis-developer/testcontainers-redis Example with testcontainers and localstack S3 here - https://github.com/zio/zio-connect/pull/83/files#diff-e7e0899e455a741a644a05c0b26879d176a9126951477cd7c62dc19ade98b5cc
[ ] Provide a TestRedisConnector layer that allows testing with a stub. Example - https://github.com/zio/zio-connect/blob/master/connectors/file-connector/src/main/scala/zio/connect/file/TestFileConnector.scala