CrudRepository

Generates an interface with methods for creating, reading, updating and deleting the given entity.

Members

Functions

insert
void insert(T entity)

Inserts a new entity in the table.

remove
void remove(T entity)

Removes an entity from the table.

removeById
void removeById(Ids!T args)

Removes an entity from the table using its primary key(s).

select
T select(Ids!T args)

Selects and entity using the entity's primary key(s).

selectAll
T[] selectAll()

Selects every entity in the table.

update
void update(T entity)

Updates an existing entity's fields.

Examples

@Entity("example")
class Example {

   @PrimaryKey
   Integer a;

   String b;

}

Example entity = new Example();
entity.b = "test";
repository.insert(entity);
assert(repository.select(entity.a).b == "test");

Meta