52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Contracts;
|
|
|
|
interface DatabaseDriverInterface
|
|
{
|
|
/**
|
|
* Set the connection parameters and establish a connection.
|
|
*/
|
|
public function connect(array $config): bool;
|
|
|
|
/**
|
|
* Execute a raw query.
|
|
*/
|
|
public function query(string $sql, array $bindings = []): array;
|
|
|
|
/**
|
|
* Get the table schema.
|
|
*/
|
|
public function getTableSchema(string $table): array;
|
|
|
|
/**
|
|
* Get table data.
|
|
*/
|
|
public function getTableData(string $table, int $limit = 100, int $offset = 0): array;
|
|
|
|
/**
|
|
* Get the count of rows in a table.
|
|
*/
|
|
public function getTableCount(string $table): int;
|
|
|
|
/**
|
|
* Get the underlying connection instance.
|
|
*/
|
|
public function getConnection();
|
|
|
|
/**
|
|
* Export the database.
|
|
*/
|
|
public function export(array $config): string;
|
|
|
|
/**
|
|
* Import the database.
|
|
*/
|
|
public function import(array $config, string $filePath): bool;
|
|
|
|
/**
|
|
* Get database metadata (charset, collation, size, etc.)
|
|
*/
|
|
public function getDatabaseMetadata(string $database): array;
|
|
}
|