Created
December 8, 2021 10:53
-
-
Save Hkazanci93/892ef4e3c44e552c42c027f27001f568 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let album, id | |
// create an entity and save it | |
album = repository.createEntity() | |
album.artist = "Mushroomhead" | |
album.title = "The Righteous & The Butterfly" | |
album.year = 2014 | |
album.genres = [ 'metal' ] | |
album.outOfPublication = true | |
id = await repository.save(album) // '01FJYWEYRHYFT8YTEGQBABJ43J' | |
// read an entity | |
album = await repository.fetch('01FJYWEYRHYFT8YTEGQBABJ43J') | |
// update an entity | |
album.genres = [ 'metal', 'nu metal', 'avantgarde' ] | |
album.outOfPublication = false | |
id = await repository.save(album) // '01FJYWEYRHYFT8YTEGQBABJ43J' | |
// delete an entity | |
await repository.remove('01FJYWEYRHYFT8YTEGQBABJ43J') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment