Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataMapper #7

Open
harell opened this issue Jan 9, 2021 · 0 comments
Open

DataMapper #7

harell opened this issue Jan 9, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@harell
Copy link
Member

harell commented Jan 9, 2021

See [@Peaa, p. 165]

Main Features

  • Store R6 objects in a relational database
  • Retrieve R6 objects from a relational database

Under the Hood

  • Store R6 objects in Entity–attribute–value model (EAV) data model
    • Entity is the object uid. If not supplied then use md5hash?
    • Attribute is one of four: public_field, public_method, private_field or private_method
    • Value is an unboxed json string (character)
  • Optional: Include an additional entry that holds the result of serialize R6 object.

Hint

Examples

Pseudocode: Mappin a person object to and from database

character <- person(given = "Bilbo", family = "Baggins")
class(character) # person

CharacterMapper$insert(character)
candidates <- CharacterMapper$find(given = "Bilbo")

class(candidates) # list of persons
identical(candidates[[1]], character)
@harell harell added the enhancement New feature or request label Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant