SqlNameMapper

zio.blocks.sql.SqlNameMapper
See theSqlNameMapper companion trait
object SqlNameMapper

The SqlNameMapper object provides predefined strategies for transforming field names into SQL column naming conventions.

This object defines several SqlNameMapper implementations:

  • SnakeCase: Transforms strings to snake_case (default for SQL). For example, "firstName" → "first_name", "userID" → "user_id".
  • Identity: Returns the input string as-is, performing no transformation.
  • Custom: Allows for user-defined transformations by applying a given function to the input column name.

Attributes

Companion
trait
Source
SqlNameMapper.scala
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

final case class Custom(f: String => String) extends SqlNameMapper

A case class that provides a custom implementation of the SqlNameMapper trait.

A case class that provides a custom implementation of the SqlNameMapper trait.

The Custom class allows for the transformation of field names using a user-defined function. This transformation logic is encapsulated in the function f provided at instantiation.

Value parameters

f

A function that defines how to transform a field name. The function takes a string as input and returns the transformed column name as output.

Attributes

Source
SqlNameMapper.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait String => String
class Object
trait Matchable
class Any
Show all
case object Identity extends SqlNameMapper

An implementation of the SqlNameMapper trait that performs no transformation on the provided field name. The identity operation is applied, where the input string is returned unchanged.

An implementation of the SqlNameMapper trait that performs no transformation on the provided field name. The identity operation is applied, where the input string is returned unchanged.

Attributes

Source
SqlNameMapper.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait String => String
class Object
trait Matchable
class Any
Show all
Self type
Identity.type
case object SnakeCase extends SqlNameMapper

A predefined implementation of the SqlNameMapper trait that converts a given field name into snake_case format by replacing transitions between uppercase and lowercase letters with underscores (_) and converting all characters to lowercase.

A predefined implementation of the SqlNameMapper trait that converts a given field name into snake_case format by replacing transitions between uppercase and lowercase letters with underscores (_) and converting all characters to lowercase.

For example, "firstName" is transformed into "first_name", and "userID" is transformed into "user_id".

Attributes

Source
SqlNameMapper.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait String => String
class Object
trait Matchable
class Any
Show all
Self type
SnakeCase.type

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
Source
Mirror.scala
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror
Source
Mirror.scala