1. save_data
2. get_data_count
3. get_data
4. get_data_by_id
5. check_data
used to check repo entries by id field. If the item exists, it returns true, otherwise false.
6. update_data_by_id
7. delete_data_by_id
8. delete_data_by_key
- used to save data to the database
- syntax:
in which:Code:save_data(key, data) - key (string): repository name
- data (array): array of data that needs to be stored. usually json.
example:
Code:{% do save_data('blog', { 'title' => 'Hello world!', 'content' => 'We are wap4 community' }) %}
2. get_data_count
- used to count the number of entries stored in a repo
- syntax:
Code:get_data_count(key)
3. get_data
- used to get the data list of a repo
- syntax:
in which:Code:get_data(key, per_page, page, order, sort) - key (string): repository name
- per_page (int): number of entries on a page
- page (int): current page
- order (string): filter by list. usually id or time.
- sort (string): usually asc or desc.
4. get_data_by_id
- used to get data according to id field of that data
- syntax:
Code:get_data(key, id) - result: array
Code:[ 'id' => 1, 'data' => [ 'title' => 'Hello world!', 'content' => 'We are wap4 community' ], 'time' => 123456 ]
5. check_data
used to check repo entries by id field. If the item exists, it returns true, otherwise false.
- syntax:
Code:check_data(key, id)
6. update_data_by_id
- used to update data for entries
- syntax:
in which:Code:update_data_by_id(key, id, data) - key (string): repository name
- id (int): id of entry
- data (array): array of data that needs to be stored. usually json.
7. delete_data_by_id
- syntax:
Code:delete_data_by_id(key, id)
8. delete_data_by_key
- syntax:
Code:delete_data_by_key(key)
Last edited: