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

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