Skip to content

Commit

Permalink
Merge branch 'master' into update/sbt-ci-release-1.5.12
Browse files Browse the repository at this point in the history
  • Loading branch information
scala-steward committed Jul 27, 2023
2 parents 5ad1914 + 49c6f2a commit 9f1becd
Show file tree
Hide file tree
Showing 58 changed files with 1,376 additions and 2,073 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 3.7.10
9bcedec20a4fc7adedce8aea4921c05b0c7acfa4
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: CI

env:
JDK_JAVA_OPTIONS: -XX:+PrintCommandLineFlags -XX:+UseG1GC -Xmx4g -Xms4g
JVM_OPTS: -XX:+PrintCommandLineFlags -XX:+UseG1GC -Xmx4g -Xms4g
JDK_JAVA_OPTIONS: -XX:+PrintCommandLineFlags -XX:+UseG1GC -Xmx4g -Xms4g -Xss4m
JVM_OPTS: -XX:+PrintCommandLineFlags -XX:+UseG1GC -Xmx4g -Xms4g -Xss4m

on:
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.5.9"
version = "3.7.10"
maxColumn = 120
align.preset = most
continuationIndent.defnSite = 2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

ZIO SQL lets you write type-safe, type-inferred, and composable SQL queries in ordinary Scala, helping you prevent persistence bugs before they happen, and leverage your IDE to make writing SQL productive, safe, and fun.

[![Production Ready](https://img.shields.io/badge/Project%20Stage-Production%20Ready-brightgreen.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-sql/workflows/CI/badge.svg) [![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-sql_2.13.svg?label=Sonatype%20Release)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-sql_2.13/) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-sql_2.13.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-sql_2.13/) [![javadoc](https://javadoc.io/badge2/dev.zio/zio-sql-docs_2.13/javadoc.svg)](https://javadoc.io/doc/dev.zio/zio-sql-docs_2.13) [![ZIO SQL](https://img.shields.io/github/stars/zio/zio-sql?style=social)](https://github.com/zio/zio-sql)
[![Development](https://img.shields.io/badge/Project%20Stage-Development-green.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-sql/workflows/CI/badge.svg) [![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-sql_2.13.svg?label=Sonatype%20Release)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-sql_2.13/) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-sql_2.13.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-sql_2.13/) [![javadoc](https://javadoc.io/badge2/dev.zio/zio-sql-docs_2.13/javadoc.svg)](https://javadoc.io/doc/dev.zio/zio-sql-docs_2.13) [![ZIO SQL](https://img.shields.io/github/stars/zio/zio-sql?style=social)](https://github.com/zio/zio-sql)

## Introduction

Expand Down
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ addCommandAlias("check", "all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck"
val zioVersion = "2.0.6"
val zioSchemaVersion = "0.4.2"
val testcontainersVersion = "1.17.6"
val testcontainersScalaVersion = "0.40.11"
val testcontainersScalaVersion = "0.40.17"
val logbackVersion = "1.2.11"

lazy val root = project
Expand Down Expand Up @@ -98,7 +98,7 @@ lazy val docs = project
crossScalaVersions := Seq(Scala213, Scala212, ScalaDotty),
projectName := "ZIO SQL",
mainModuleName := (coreJVM / moduleName).value,
projectStage := ProjectStage.ProductionReady,
projectStage := ProjectStage.Development,
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(),
docsPublishBranch := "master",
readmeContribution := readmeContribution.value +
Expand Down Expand Up @@ -131,6 +131,7 @@ lazy val examples = project

lazy val driver = project
.in(file("driver"))
.dependsOn(coreJVM)
.settings(stdSettings("zio-sql-driver"))
.settings(buildInfoSettings("zio.sql.driver"))
.settings(
Expand Down
14 changes: 8 additions & 6 deletions core/jvm/src/main/scala/zio/sql/Sql.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package zio.sql

import zio.schema.Schema
import zio.schema.{ Schema, StandardType }
import zio.sql.table._
import zio.sql.update._
import zio.sql.select._
import zio.sql.insert._
import zio.sql.delete._

case class SqlRow(params: List[SqlParameter])
case class SqlParameter(_type: StandardType[_], value: Any)
case class SqlStatement(query: String, rows: List[SqlRow])

trait Sql {

/*
Expand Down Expand Up @@ -34,23 +38,21 @@ trait Sql {
def select[F, A, B <: SelectionSet[A]](selection: Selection[F, A, B]): SelectBuilder[F, A, B] =
SelectBuilder[F, A, B](selection)

def subselect[ParentTable]: SubselectPartiallyApplied[ParentTable] = new SubselectPartiallyApplied[ParentTable]
def subselect[ParentTable]: SubselectByCommaBuilder[ParentTable] = new SubselectByCommaBuilder[ParentTable]

def deleteFrom[T <: Table](table: T): Delete[table.TableType] = Delete(table, true)

def update[A](table: Table.Aux[A]): UpdateBuilder[A] = UpdateBuilder(table)

def insertInto[Source, AllColumnIdentities](
table: Table.Source.Aux_[Source, AllColumnIdentities]
): InsertByCommaBuilder[Source, AllColumnIdentities] = InsertByCommaBuilder(table)
val insertInto: InsertByCommaBuilder = InsertByCommaBuilder()

def renderDelete(delete: Delete[_]): String

def renderRead(read: Read[_]): String

def renderUpdate(update: Update[_]): String

def renderInsert[A: Schema](insert: Insert[_, A]): String
def renderInsert[A: Schema](insert: Insert[_, A]): SqlStatement

// TODO don't know where to put it now
implicit def convertOptionToSome[A](implicit op: Schema[Option[A]]): Schema[Some[A]] =
Expand Down
4 changes: 1 addition & 3 deletions core/jvm/src/main/scala/zio/sql/expr/Expr.scala
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ sealed trait Expr[-F, -A, +B] { self =>

object Expr {

implicit val subqueryToExpr = Read.Subselect.subselectToExpr _

sealed trait InvariantExpr[F, -A, B] extends Expr[F, A, B] {
def typeTag: TypeTag[B]
}
Expand All @@ -134,7 +132,7 @@ object Expr {
implicit def literal[A: TypeTag](a: A): Expr[Features.Literal, Any, A] = Expr.Literal(a)

implicit def some[A: TypeTag.NotNull](someA: Some[A]): Expr[Features.Literal, Any, Option[A]] = {
implicit val typeTagA = TypeTag.Nullable[A]()
implicit val typeTagA: TypeTag.Nullable[A] = TypeTag.Nullable[A]()
Expr.Literal[Option[A]](someA)
}

Expand Down
8 changes: 4 additions & 4 deletions core/jvm/src/main/scala/zio/sql/insert/InsertBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import zio.sql.macros._
import zio.sql.table._
import zio.sql.select._

final case class InsertBuilder[F, Source, AllColumnIdentities, B <: SelectionSet[Source], ColsRepr](
final case class InsertBuilder[F, Source, AllColumnIdentities, B <: SelectionSet[Source]](
table: Table.Source.Aux_[Source, AllColumnIdentities],
sources: Selection.Aux[F, Source, B, ColsRepr]
sources: Selection[F, Source, B]
) {

def values[Z](values: Seq[Z])(implicit
schemaCC: Schema[Z],
schemaValidity: InsertLike[F, ColsRepr, AllColumnIdentities, Z]
schemaValidity: InsertLike[F, sources.ColsRepr, AllColumnIdentities, Z]
): Insert[Source, Z] = Insert(table, sources.value, values)

def values[Z](value: Z)(implicit
schemaCC: Schema[Z],
schemaValidity: InsertLike[F, ColsRepr, AllColumnIdentities, Z]
schemaValidity: InsertLike[F, sources.ColsRepr, AllColumnIdentities, Z]
): Insert[Source, Z] = Insert(table, sources.value, Seq(value))
}
Loading

0 comments on commit 9f1becd

Please sign in to comment.