Record Class
Record.Rd
The Record class represents a single row in a database table. It provides methods for creating, updating, and deleting individual records.
Details
Record is an R6 class that works in conjunction with the TableModel class. Each Record instance corresponds to a single row in the database table represented by its associated TableModel. The class provides methods for CRUD (Create, Read, Update, Delete) operations on individual records.
Methods
initialize(model, data = list())
Constructor for creating a new Record instance.
create()
Inserts this record into the database.
update()
Updates this record in the database.
delete()
Deletes this record from the database.
Public fields
model
A TableModel object. Represents the database table this record belongs to.
data
A list. Contains the data for this record, with column names as keys.
relationships
A list. Contains the relationships defined for this record's model.
Methods
Method new()
Initialize a new Record instance.
Method update()
Update this record in the database.
Usage
Record$update(..., .data = list())
Method relationship()
Retrieve related records based on a defined relationship.
Arguments
rel_name
The name of the relationship to query.
...
Additional arguments passed to the related model's read method.