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