Skip to content

Instantly share code, notes, and snippets.

@agustinustheo
Last active October 26, 2020 22:36
Show Gist options
  • Save agustinustheo/3a4735fb9bf30d9b809ae0bf342b991b to your computer and use it in GitHub Desktop.
Save agustinustheo/3a4735fb9bf30d9b809ae0bf342b991b to your computer and use it in GitHub Desktop.
To-do helper for Flask-FaunaDB example.
from entities.faunadb_entity import get, get_multiple, get_by_ref_id, create, update, delete
def get_all_todos():
try:
return get_multiple('all_todos')
except Exception as ex:
raise ex
def get_todo_by_ref_id(id):
try:
return get_by_ref_id('todo', id)
except Exception as ex:
raise ex
def create_todo(data):
try:
return create('todo', data)
except Exception as ex:
raise ex
def update_todo(id, data):
try:
return update('todo', id, data)
except Exception as ex:
raise ex
def delete_todo(id):
try:
return delete('todo', id)
except Exception as ex:
raise ex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment