Skip to content

Commit

Permalink
Doc edits
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilquist committed Dec 17, 2022
1 parent 0a7403c commit 561144b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
10 changes: 5 additions & 5 deletions modules/core/shared/src/main/scala/Session.scala
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ trait Session[F[_]] {
* times with different arguments.
* @group Queries
*/
def prepare[A, B](query: Query[A, B]): Resource[F, PreparedQuery[F, A, B]] =
def prepare[A, B](query: Query[A, B]): Resource[F, PreparedQuery[F, A, B]] =
Resource.eval(prepareAndCache(query))

/**
Expand All @@ -143,16 +143,16 @@ trait Session[F[_]] {
*/
def prepare[A](command: Command[A]): Resource[F, PreparedCommand[F, A]] =
Resource.eval(prepareAndCache(command))

/**
* Prepares then cache a query, yielding a `PreparedQuery` which can be executed multiple
* times with different arguments.
* Prepares then caches a query, yielding a `PreparedQuery` which can be executed multiple
* times with different arguments.
* @group Queries
*/
def prepareAndCache[A, B](query: Query[A, B]): F[PreparedQuery[F, A, B]]

/**
* Prepares then cache an `INSERT`, `UPDATE`, or `DELETE` command that returns no rows. The resulting
* Prepares then caches an `INSERT`, `UPDATE`, or `DELETE` command that returns no rows. The resulting
* `PreparedCommand` can be executed multiple times with different arguments.
* @group Commands
*/
Expand Down
7 changes: 3 additions & 4 deletions modules/core/shared/src/main/scala/data/SemispaceCache.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ sealed abstract case class SemispaceCache[K, V](gen0: Map[K, V], gen1: Map[K, V]
def containsKey(k: K): Boolean =
gen0.contains(k) || gen1.contains(k)

def values: Seq[V] =
(gen0.values.toSet | gen1.values.toSet).toSeq

def values: Seq[V] =
(gen0.values.toSet | gen1.values.toSet).toSeq
}

object SemispaceCache {
Expand All @@ -41,4 +40,4 @@ object SemispaceCache {
def empty[K, V](max: Int): SemispaceCache[K, V] =
SemispaceCache[K, V](Map.empty, Map.empty, max max 0)

}
}
11 changes: 5 additions & 6 deletions modules/core/shared/src/main/scala/net/Protocol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ trait Protocol[F[_]] {

/**
* Prepare a command (a statement that produces no rows), yielding a `Protocol.PreparedCommand`
* which will cached per session and closed on session close.
* which will be cached per session and closed on session close.
*/
def prepare[A](command: Command[A], ty: Typer): F[Protocol.PreparedCommand[F, A]]

/**
* Prepare a query (a statement that produces rows), yielding a `Protocol.PreparedCommand` which
* which will cached per session and closed on session close.
* which will be cached per session and closed on session close.
*/
def prepare[A, B](query: Query[A, B], ty: Typer): F[Protocol.PreparedQuery[F, A, B]]

Expand All @@ -94,9 +94,9 @@ trait Protocol[F[_]] {
def startup(user: String, database: String, password: Option[String], parameters: Map[String, String]): F[Unit]

/**
* Cleanup the session. This will close ay cached prepared statement
* Cleanup the session. This will close any cached prepared statements.
*/
def cleanup:F[Unit]
def cleanup: F[Unit]

/**
* Signal representing the current transaction status as reported by `ReadyForQuery`. It's not
Expand All @@ -106,10 +106,9 @@ trait Protocol[F[_]] {

/** Cache for the `Describe` protocol. */
def describeCache: Describe.Cache[F]

/** Cache for the `Parse` protocol. */
def parseCache: Parse.Cache[F]

}

object Protocol {
Expand Down
4 changes: 2 additions & 2 deletions modules/core/shared/src/main/scala/net/protocol/Prepare.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object Prepare {
}
}
}

override def apply[A, B](query: skunk.Query[A, B], ty: Typer): F[PreparedQuery[F, A, B]] =
for {
id <- Parse[F](parseCache).apply(query, ty)
Expand All @@ -58,4 +58,4 @@ object Prepare {

}

}
}

0 comments on commit 561144b

Please sign in to comment.