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

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