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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 Provide a new uniq numeric ID
  7. #@param emcomp LeObject subclass (not instance) : To know on wich things we
  8. #have to be uniq
  9. #@return an integer
  10. def new_numeric_id(self, emcomp):
  11. pass
  12. ##@brief returns a selection of documents from the datasource
  13. #@param target_cls Emclass
  14. #@param field_list list
  15. #@param filters list : List of filters
  16. #@param rel_filters list : List of relational filters
  17. #@param order list : List of column to order. ex: order = [('title', 'ASC'),]
  18. #@param group list : List of tupple representing the column to group together. ex: group = [('title', 'ASC'),]
  19. #@param limit int : Number of records to be returned
  20. #@param offset int: used with limit to choose the start record
  21. #@param instanciate bool : If true, the records are returned as instances, else they are returned as dict
  22. #@return list
  23. def select(self, target_cls, field_list, filters, rel_filters=None, order=None, group=None, limit=None, offset=0,
  24. instanciate=True):
  25. pass
  26. ##@brief Deletes records according to given filters
  27. #@param target Emclass : class of the record to delete
  28. #@param filters list : List of filters
  29. #@param relational_filters list : List of relational filters
  30. #@return int : number of deleted records
  31. def delete(self, target, filters, relational_filters):
  32. return 0
  33. ## @brief updates records according to given filters
  34. #@param target Emclass : class of the object to insert
  35. #@param filters list : List of filters
  36. #@param rel_filters list : List of relational filters
  37. #@param upd_datas dict : datas to update (new values)
  38. #@return int : Number of updated records
  39. def update(self, target, filters, relational_filters, upd_datas):
  40. return 0
  41. ## @brief Inserts a record in a given collection
  42. # @param target Emclass : class of the object to insert
  43. # @param new_datas dict : datas to insert
  44. # @return the inserted uid
  45. def insert(self, target, new_datas):
  46. return 0
  47. ## @brief Inserts a list of records in a given collection
  48. # @param target Emclass : class of the objects inserted
  49. # @param datas_list list : list of dict
  50. # @return list : list of the inserted records' ids
  51. def insert_multi(self, target, datas_list):
  52. return 0