struct Athena::ORM::Mapping::DefaultQuoteStrategy
inherits Struct
#
The quote strategy used for every entity.
Names aren't quoted automatically, since quoting can change which table or column a name refers to.
For example, PostgreSQL folds unquoted names to lower case, but matches quoted ones exactly.
Instead, quoting is opted into per name by wrapping it in backticks in the mapping.
The name is then quoted in every statement, using the quoting of the database platform: `groups` on MySQL and MariaDB, "groups" on PostgreSQL and SQLite.
# `groups` is a reserved word on MySQL.
@[AORMA::Entity]
@[AORMA::Table(name: "`groups`")]
class Group < AORM::Entity
@[AORMA::Column(name: "`order`")]
property! order : Int32
# ...
end
Backticks are supported in the names of tables (AORMA::Table), columns (AORMA::Column), join tables (AORMA::JoinTable), and join columns (AORMA::JoinColumn and AORMA::InverseJoinColumn, both name and referenced_column_name).
Included modules
Athena::ORM::Mapping::QuoteStrategyInterface
Constructors#
Methods#
#column_alias(column_name : String, counter : Int, platform : Platforms::Platform, class_metadata : Mapping::ClassInterface | Nil = nil) : String#
Returns a unique result column alias for column_name, valid on platform.
#column_name(field_name : String, class_metadata : Mapping::ClassInterface, platform : Platforms::Platform) : String#
Returns the column name of the field named field_name of class_metadata, quoted if needed.
#identifier_column_names(class_metadata : Mapping::ClassInterface, platform : Platforms::Platform) : Array(String)#
Returns the column names of the identifier fields of class_metadata, quoted if needed.
#join_column_name(join_column : Mapping::JoinColumn, class_metadata : Mapping::ClassInterface, platform : Platforms::Platform) : String#
Returns the name of join_column, quoted if needed.
#join_table_name(association : Mapping::ManyToManyOwningSide, class_metadata : Mapping::ClassInterface, platform : Platforms::Platform) : String#
Returns the join table name of association.
#referenced_join_column_name(join_column : Mapping::JoinColumn, class_metadata : Mapping::ClassInterface, platform : Platforms::Platform) : String#
Returns the name of the column join_column references, quoted if needed.
#table_name(class_metadata : Mapping::ClassInterface, platform : Platforms::Platform) : String#
Returns the table name of class_metadata, quoted if needed.