scorpion.repository

Undocumented in source.

Members

Aliases

OrderBy
alias OrderBy = Database.Clause.Order.Field

Specifies in which order the result of a select query should be returned. It is possible to add one or more OrderBy attributes to the same method with different field names.

Classes

DatabaseRepository
class DatabaseRepository(T : Repository!R, R)
Undocumented in source.

Enums

Insert
enum Insert

Indicates that a newly created entity will be inserted in the database. If the entity has one or more primary keys their values will be updated.

OrderByRandom
enum OrderByRandom

Specifies that the result of a select query should be returned randomly ordered. This action is usually performed directly from the database. It's not possible to use any other order attribute associated with this one.

Remove
enum Remove

Deletes one or more entities from the database. If the entity does not have any primary key the Where attribute must also be present.

Select
enum Select

Indicates that one or more entities will be selected from the database. The return type of a method marked with the @Select atribute can be either T or T[], where T is the entity specified in the repository's declaration.

Update
enum Update

Indicates that an existing entity will be updated. The updated fields can be specified with the Fields attribute; if the attributes is not present all fields except the primary keys will be updated. If the entity does not have any primary key the Where attribute must also be present.

Interfaces

Repository
interface Repository(T)

Base interface for repositories. Every repository that implements this interface will be extended by scorpion and its methods implemented. Every method in the interface must have either the attribute @Select, @Insert, @Update or @Remove that indicates which action the repository will perform using the database.

Structs

Fields
struct Fields

Indicates which field(s) to update when updating an entity. This is useful when having an entity with a field that holds big data and and a small field that is updated frequently. By adding the Fields attribute the big data is not sent to the database and updated every time the small field is, saving time.

Limit
struct Limit

Limits the number of results returned by a select query. It is possible, like in the Where attribute, to specify a value using the arguments by adding the dollar sign and the argument's index in the method.

Where
struct Where

Adds a where clause to the query. This attribute can be used with query that select, update and remove entities. It is possible to use method's arguments in the where clause by adding the dollar sign plus the index (starting from 0, obviously) of the variable.

Meta