Skip to content

Instantly share code, notes, and snippets.

@Hkazanci93
Created December 8, 2021 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hkazanci93/0347da6b40932a089dc147aa0698b503 to your computer and use it in GitHub Desktop.
Save Hkazanci93/0347da6b40932a089dc147aa0698b503 to your computer and use it in GitHub Desktop.
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