com.augustnagro.magnum

Members list

Type members

Classlikes

The total number of rows updated, or SuccessNoInfo if unknown.

The total number of rows updated, or SuccessNoInfo if unknown.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ClickhouseDbType extends DbType

Attributes

Supertypes
trait DbType
class Object
trait Matchable
class Any
Self type
class ColumnName(val scalaName: String, val sqlName: String, val queryRepr: String) extends SqlLiteral

Represents an entity column. Can be interpolated in sql"" expressions

Represents an entity column. Can be interpolated in sql"" expressions

Attributes

Supertypes
trait SqlLiteral
class Object
trait Matchable
class Any
class ColumnNames(val queryRepr: String, val columnNames: IArray[ColumnName]) extends SqlLiteral

A grouping of schema names, which may be interpolated in sql"" expressions.

A grouping of schema names, which may be interpolated in sql"" expressions.

Value parameters

columnNames

The column names.

queryRepr

The query representation. For example, "myColA, myColB"

Attributes

Supertypes
trait SqlLiteral
class Object
trait Matchable
class Any
trait DbCodec[E]

Typeclass for JDBC reading & writing.

Typeclass for JDBC reading & writing.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object AnyCodec.type
object BooleanCodec.type
object ByteArrayCodec.type
object ByteCodec.type
object ByteIArrayCodec.type
object DoubleCodec.type
object FloatCodec.type
object IntCodec.type
object JavaBigDecimalCodec.type
object LongCodec.type
object OffsetDateTimeCodec.type
object RowIdCodec.type
object ScalaBigDecimalCodec.type
object ShortCodec.type
object SqlBlobCodec.type
object SqlClobCodec.type
object SqlDateCodec.type
object SqlNClobCodec.type
object SqlRefCodec.type
object SqlTimeCodec.type
object SqlTimestampCodec.type
object SqlXmlCodec.type
object StringCodec.type
object URLCodec.type
object UUIDCodec.type
object VarCharUUIDCodec.type
Show all
Self type
DbCodec[E]
object DbCodec

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
DbCodec.type
class DbCon

Simple wrapper around java.sql.Connection. See com.augustnagro.magnum.connect and transact

Simple wrapper around java.sql.Connection. See com.augustnagro.magnum.connect and transact

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class DbTx
class DbTx extends DbCon

Represents a transactional DbCon

Represents a transactional DbCon

Attributes

Supertypes
class DbCon
class Object
trait Matchable
class Any
trait DbType

Factory for Repo default methods

Factory for Repo default methods

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object ClickhouseDbType.type
object H2DbType.type
object MySqlDbType.type
object OracleDbType.type
object PostgresDbType.type
object SqliteDbType.type
Show all
object DerivingUtil

Not useful for typical user code; provided to help implement custom DbCodecs and associated typeclasses

Not useful for typical user code; provided to help implement custom DbCodecs and associated typeclasses

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
case class Frag(sqlString: String, params: Seq[Any], writer: FragWriter)

Sql fragment

Sql fragment

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Frag

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Frag.type
trait FragWriter

Attributes

Supertypes
class Object
trait Matchable
class Any
object H2DbType extends DbType

Attributes

Supertypes
trait DbType
class Object
trait Matchable
class Any
Self type
H2DbType.type
class Id extends StaticAnnotation

Attributes

Supertypes
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
open class ImmutableRepo[E, ID](using defaults: RepoDefaults[_, E, ID])

Repository supporting read-only queries. When entity E does not have an id, use Null for the Id type.

Repository supporting read-only queries. When entity E does not have an id, use Null for the Id type.

Type parameters

E

database entity class

ID

id type of E

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Repo[EC, E, ID]
object MySqlDbType extends DbType

Attributes

Supertypes
trait DbType
class Object
trait Matchable
class Any
Self type
trait NullOrder

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object First.type
object Last.type
object NullOrder

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
NullOrder.type
object OracleDbType extends DbType

Attributes

Supertypes
trait DbType
class Object
trait Matchable
class Any
Self type
object PostgresDbType extends DbType

Attributes

Supertypes
trait DbType
class Object
trait Matchable
class Any
Self type
case class Query[E](frag: Frag, reader: DbCodec[E])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
open class Repo[EC, E, ID](using defaults: RepoDefaults[EC, E, ID]) extends ImmutableRepo[E, ID]

A read & write data repository

A read & write data repository

Type parameters

E

database entity class

EC

'Entity Creator', which should have all fields of E minus those auto-generated by the database. Can be the same type as E.

ID

id type of E

Attributes

Supertypes
class ImmutableRepo[E, ID]
class Object
trait Matchable
class Any
trait RepoDefaults[EC, E, ID]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object RepoDefaults

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
case class Returning[E](frag: Frag, reader: DbCodec[E])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait SeekDir

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Gt.type
object Lt.type
object SeekDir

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
SeekDir.type
trait SortOrder

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Asc.type
object Desc.type
object SortOrder

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
SortOrder.type
class Spec[E]

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Spec

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Spec.type
class SqlException extends RuntimeException

Attributes

Supertypes
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Metadata for a exceptional SQL statement.

Metadata for a exceptional SQL statement.

Attributes

Supertypes
class Object
trait Matchable
class Any
trait SqlLiteral

A SQL string that is interpolated directly into a sql"" query (and not as a PreparedStatement parameter)

A SQL string that is interpolated directly into a sql"" query (and not as a PreparedStatement parameter)

For example,

 val myQaSchema = SqlLiteral("db_qa")
 sql"SELECT * FROM $myQaSchema.table_name"

Generates the SQL:

 "SELECT * FROM db_qa.table_name"

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ColumnName
class ColumnNames
class TableInfo[EC, E, ID]
object SqlLiteral

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
SqlLiteral.type
trait SqlLogger

Trait to provide logging of Magnum SQL statements.

Trait to provide logging of Magnum SQL statements.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Default.type
object NoOp.type
object SqlLogger

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
SqlLogger.type
class SqlName(val name: String) extends StaticAnnotation

Attributes

Supertypes
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any

Mapping from scala terms to sql terms

Mapping from scala terms to sql terms

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object CamelToSnakeCase.type
object CamelToUpperSnakeCase.type
object SameCase.type
object SqlNameMapper

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type

Metadata for a successfully executed SQL statement.

Metadata for a successfully executed SQL statement.

Attributes

Supertypes
class Object
trait Matchable
class Any
object SqliteDbType extends DbType

Attributes

Supertypes
trait DbType
class Object
trait Matchable
class Any
Self type
class Table(val dbType: DbType, val nameMapper: SqlNameMapper) extends StaticAnnotation

Attributes

Supertypes
trait StaticAnnotation
class Annotation
class Object
trait Matchable
class Any
class TableInfo[EC, E, ID](val all: ColumnNames, val insertColumns: ColumnNames, val alias: Option[String], val queryRepr: String, val table: String, val eClassName: String) extends Selectable, SqlLiteral

Metadata about a Table, which can be interpolated in sql"" expressions

Metadata about a Table, which can be interpolated in sql"" expressions

For example,

 @Table(PostgresDbType, SqlNameMapper.CamelToSnakeCase)
 case class User(@Id id: Long, firstName: String)
   derives DbCodec

 val u = TableInfo[User, User, Long].alias("u")

 sql"SELECT ${u.firstName} FROM $u".sqlString ==
   "SELECT u.first_name FROM user u"

Attributes

Companion
object
Supertypes
trait SqlLiteral
trait Selectable
class Object
trait Matchable
class Any
object TableInfo

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
TableInfo.type
case class Transactor(dataSource: DataSource, sqlLogger: SqlLogger, connectionConfig: Connection => Unit)

Transactor lets you customize a transaction or connection's behavior. It is a parameter to the transact and connect methods.

Transactor lets you customize a transaction or connection's behavior. It is a parameter to the transact and connect methods.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object UUIDCodec

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
UUIDCodec.type
case class Update(frag: Frag)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def batchUpdate[T](values: Iterable[T])(f: T => Update)(using con: DbCon): BatchUpdateResult
def connect[T](transactor: Transactor)(f: DbCon ?=> T): T
def connect[T](dataSource: DataSource)(f: DbCon ?=> T): T
def transact[T](transactor: Transactor)(f: DbTx ?=> T): T
def transact[T](dataSource: DataSource)(f: DbTx ?=> T): T
def transact[T](dataSource: DataSource, connectionConfig: Connection => Unit)(f: DbTx ?=> T): T

Extensions

Extensions

extension (sc: StringContext)(inline sc: StringContext)
inline def sql(inline args: Any*): Frag