| 1 |
<?php |
| 2 |
namespace Imagify\DB; |
| 3 |
|
| 4 |
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
| 5 |
|
| 6 |
/** |
| 7 |
* Interface to interact with the database. |
| 8 |
* |
| 9 |
* @since 1.9 |
| 10 |
* @author Grégory Viguier |
| 11 |
*/ |
| 12 |
interface DBInterface { |
| 13 |
|
| 14 |
/** |
| 15 |
* Get the main Instance. |
| 16 |
* |
| 17 |
* @since 1.9 |
| 18 |
* @access public |
| 19 |
* @author Grégory Viguier |
| 20 |
* |
| 21 |
* @return DBInterface Main instance. |
| 22 |
*/ |
| 23 |
public static function get_instance(); |
| 24 |
|
| 25 |
/** |
| 26 |
* Retrieve a row by the primary key. |
| 27 |
* |
| 28 |
* @since 1.9 |
| 29 |
* @access public |
| 30 |
* @author Grégory Viguier |
| 31 |
* |
| 32 |
* @param int $row_id A primary key. |
| 33 |
* @return array |
| 34 |
*/ |
| 35 |
public function get( $row_id ); |
| 36 |
|
| 37 |
/** |
| 38 |
* Update a row. |
| 39 |
* |
| 40 |
* @since 1.9 |
| 41 |
* @access public |
| 42 |
* @author Grégory Viguier |
| 43 |
* |
| 44 |
* @param int $row_id A primary key. |
| 45 |
* @param array $data New data. |
| 46 |
* @param string $where A column name. |
| 47 |
* @return bool |
| 48 |
*/ |
| 49 |
public function update( $row_id, $data = [], $where = '' ); |
| 50 |
|
| 51 |
/** |
| 52 |
* Delete a row identified by the primary key. |
| 53 |
* |
| 54 |
* @since 1.9 |
| 55 |
* @access public |
| 56 |
* @author Grégory Viguier |
| 57 |
* |
| 58 |
* @param int $row_id A primary key. |
| 59 |
* @return bool |
| 60 |
*/ |
| 61 |
public function delete( $row_id ); |
| 62 |
|
| 63 |
/** |
| 64 |
* Default column values. |
| 65 |
* |
| 66 |
* @since 1.9 |
| 67 |
* @access public |
| 68 |
* @author Grégory Viguier |
| 69 |
* |
| 70 |
* @return array |
| 71 |
*/ |
| 72 |
public function get_column_defaults(); |
| 73 |
|
| 74 |
/** |
| 75 |
* Get the primary column name. |
| 76 |
* |
| 77 |
* @since 1.9 |
| 78 |
* @access public |
| 79 |
* @author Grégory Viguier |
| 80 |
* |
| 81 |
* @return string |
| 82 |
*/ |
| 83 |
public function get_primary_key(); |
| 84 |
} |
| 85 |
|