Skip to content

Commit

Permalink
Merge pull request #2160 from typelevel/fix_docs
Browse files Browse the repository at this point in the history
Fix docs and check makeSite passes in CI
  • Loading branch information
jatcwang authored Dec 14, 2024
2 parents e32a586 + 4f7dbe5 commit 010a978
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ jobs:
- name: Check there are no uncommitted changes in git (to catch generated files that weren't committed)
run: sbt '++ ${{ matrix.scala }}' checkGitNoUncommittedChanges

- name: Check Doc Site (2.13.15 only)
if: matrix.scala == '2.13.15'
- name: Check Doc Site (2.13 only)
if: matrix.scala == '2.13'
run: sbt '++ ${{ matrix.scala }}' docs/makeSite

- name: Make target directories
Expand Down
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ ThisBuild / githubWorkflowBuildPostamble ++= Seq(
),
WorkflowStep.Sbt(
commands = List("docs/makeSite"),
name = Some(s"Check Doc Site ($scala213Version only)"),
cond = Some(s"matrix.scala == '$scala213Version'")
name = Some(s"Check Doc Site (2.13 only)"),
cond = Some(s"matrix.scala == '2.13'")
)
)

Expand Down Expand Up @@ -539,6 +539,7 @@ lazy val docs = project
"scalaVersion" -> scalaVersion.value
),
mdocIn := baseDirectory.value / "src" / "main" / "mdoc",
mdocExtraArguments ++= Seq("--no-link-hygiene"),
Compile / paradox / sourceDirectory := mdocOut.value,
makeSite := makeSite.dependsOn(mdoc.toTask("")).value
)
Expand Down
17 changes: 9 additions & 8 deletions modules/docs/src/main/mdoc/docs/15-Extensions-PostgreSQL.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ object MyEnum extends Enumeration {
val foo, bar = Value
}

implicit val MyEnumMeta = pgEnum(MyEnum, "myenum")
implicit val MyEnumMeta: Meta[MyEnum.Value] = pgEnum(MyEnum, "myenum")
```

```scala mdoc
Expand Down Expand Up @@ -214,14 +214,14 @@ In addition to the general types above, **doobie** provides mappings for the fol

[Geographic types](http://postgis.net/workshops/postgis-intro/geography.html) mappings are defined in a different object (`pgisgeographyimplicits`), to allow geometric types using geodetic coordinates.

```
```scala
import doobie.postgres.pgisgeographyimplicits._

// or define the implicit conversion manually

implicit val geographyPoint: Meta[Point] =
doobie.postgres.pgisgeographyimplicits.PointType
implicit val geographyPoint: Meta[Point] = doobie.postgres.pgisgeographyimplicits.PointType
```

- Point
- Polygon
- MultiPoint
Expand All @@ -242,17 +242,17 @@ The following range types are supported, and map to **doobie** generic `Range[T]
- the `tstzrange` schema type maps to `Range[java.time.OffsetDateTime]`

Non empty range maps to:
```scala mdoc:silent
```scala
case class NonEmptyRange[T](lowerBound: Option[T], upperBound: Option[T], edge: Edge) extends Range[T]
```

Empty range maps to:
```scala mdoc:silent
```scala
case object EmptyRange extends Range[Nothing]
```
To control the inclusive and exclusive bounds according to the [PostgreSQL](https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-INCLUSIVITY) specification you need to use a special `Edge` enumeration when creating a `Range`:

```scala mdoc:silent
```scala
object Edge {
case object ExclExcl extends Edge
case object ExclIncl extends Edge
Expand All @@ -271,13 +271,14 @@ import doobie.postgres.rangeimplicits._

To create for example custom implementation of `Range[Byte]` you can use the public method which declared in the following package `doobie.postgres.rangeimplicits`:

```scala mdoc:silent
```scala
def rangeMeta[T](sqlRangeType: String)(encode: T => String, decode: String => T): Meta[Range[T]]
```

For a `Range[Byte]`, the meta and bounds encoder and decoder would appear as follows:
```scala mdoc:silent
import doobie.postgres.rangeimplicits._
import doobie.postgres.types.Range

implicit val byteRangeMeta: Meta[Range[Byte]] = rangeMeta[Byte]("int4range")(_.toString, _.toByte)

Expand Down
4 changes: 2 additions & 2 deletions modules/docs/src/main/mdoc/docs/17-FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ As of **doobie** 0.4 there is a reasonable solution to the logging/instrumentati
There are a lot of ways to handle `SQLXML` so there is no pre-defined strategy, but here is one that maps `scala.xml.Elem` to `SQLXML` via streaming.

```scala mdoc:silent
import doobie.enum.JdbcType.Other
import doobie.enumerated.JdbcType.Other
import java.sql.SQLXML
import scala.xml.{ XML, Elem }

Expand Down Expand Up @@ -181,7 +181,7 @@ Domains with check constraints will type check as DISTINCT. For Doobie later tha
```scala mdoc:silent
import cats.data.NonEmptyList
import doobie._
import doobie.enum.JdbcType
import doobie.enumerated.JdbcType

object distinct {

Expand Down

0 comments on commit 010a978

Please sign in to comment.