Created
December 8, 2021 12:12
-
-
Save Hkazanci93/356389dbaa07d1c3d656b418ea5e782c 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