| 1 |
<?php |
| 2 |
/** |
| 3 |
* Interface for a Database Driver. |
| 4 |
* |
| 5 |
* @todo Review. Heavy refactor maybe needed. |
| 6 |
* @package WP_Stream |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace WP_Stream; |
| 10 |
|
| 11 |
/** |
| 12 |
* Interface - DB_Driver |
| 13 |
*/ |
| 14 |
interface DB_Driver { |
| 15 |
/** |
| 16 |
* Insert a record |
| 17 |
* |
| 18 |
* @param array $data Data to be insert into the database. |
| 19 |
* |
| 20 |
* @return int |
| 21 |
*/ |
| 22 |
public function insert_record( $data ); |
| 23 |
|
| 24 |
/** |
| 25 |
* Retrieve records |
| 26 |
* |
| 27 |
* @param array $args Argument to filter the result by. |
| 28 |
* |
| 29 |
* @return array |
| 30 |
*/ |
| 31 |
public function get_records( $args ); |
| 32 |
|
| 33 |
/** |
| 34 |
* Returns array of existing values for requested column. |
| 35 |
* Used to fill search filters with only used items, instead of all items. |
| 36 |
* |
| 37 |
* @param string $column Column to pull data from. |
| 38 |
* |
| 39 |
* @return array |
| 40 |
*/ |
| 41 |
public function get_column_values( $column ); |
| 42 |
|
| 43 |
/** |
| 44 |
* Public getter to return the names of the tables this driver manages. |
| 45 |
* |
| 46 |
* @return array |
| 47 |
*/ |
| 48 |
public function get_table_names(); |
| 49 |
|
| 50 |
/** |
| 51 |
* Init storage. |
| 52 |
* |
| 53 |
* @param \WP_Stream\Plugin $plugin Instance of the plugin. |
| 54 |
*/ |
| 55 |
public function setup_storage( $plugin ); |
| 56 |
|
| 57 |
/** |
| 58 |
* Purge storage. |
| 59 |
* |
| 60 |
* @param \WP_Stream\Plugin $plugin Instance of the plugin. |
| 61 |
*/ |
| 62 |
public function purge_storage( $plugin ); |
| 63 |
} |
| 64 |
|