No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

datasource.py 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #-*- coding:utf-8 -*-
  2. class DummyDatasource(object):
  3. def __init__(self, *conn_args, **conn_kwargs):
  4. self.conn_args = conn_args
  5. self.conn_kwargs = conn_kwargs
  6. ## @brief returns a selection of documents from the datasource
  7. # @param target_cls Emclass
  8. # @param field_list list
  9. # @param filters list : List of filters
  10. # @param rel_filters list : List of relational filters
  11. # @param order list : List of column to order. ex: order = [('title', 'ASC'),]
  12. # @param group list : List of tupple representing the column to group together. ex: group = [('title', 'ASC'),]
  13. # @param limit int : Number of records to be returned
  14. # @param offset int: used with limit to choose the start record
  15. # @param instanciate bool : If true, the records are returned as instances, else they are returned as dict
  16. # @return list
  17. def select(self, target_cls, field_list, filters, rel_filters=None, order=None, group=None, limit=None, offset=0,
  18. instanciate=True):
  19. pass
  20. ##@brief Deletes records according to given filters
  21. #@param target Emclass : class of the record to delete
  22. #@param filters list : List of filters
  23. #@param relational_filters list : List of relational filters
  24. #@return int : number of deleted records
  25. def delete(self, target, filters, relational_filters):
  26. pass
  27. ## @brief updates records according to given filters
  28. #@param target Emclass : class of the object to insert
  29. #@param filters list : List of filters
  30. #@param rel_filters list : List of relational filters
  31. #@param upd_datas dict : datas to update (new values)
  32. #@return int : Number of updated records
  33. def update(self, target, filters, relational_filters, upd_datas):
  34. pass
  35. ## @brief Inserts a record in a given collection
  36. # @param target Emclass : class of the object to insert
  37. # @param new_datas dict : datas to insert
  38. # @return the inserted uid
  39. def insert(self, target, new_datas):
  40. pass
  41. ## @brief Inserts a list of records in a given collection
  42. # @param target Emclass : class of the objects inserted
  43. # @param datas_list list : list of dict
  44. # @return list : list of the inserted records' ids
  45. def insert_multi(self, target, datas_list):
  46. pass