Interfaces
This commit is contained in:
8
src/Concept/Database/Query.php
Normal file
8
src/Concept/Database/Query.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
namespace ProVM\Concept\Database;
|
||||||
|
|
||||||
|
interface Query
|
||||||
|
{
|
||||||
|
public function build(): string;
|
||||||
|
public function __toString(): string;
|
||||||
|
}
|
10
src/Concept/Database/Query/Delete.php
Normal file
10
src/Concept/Database/Query/Delete.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
namespace ProVM\Concept\Database\Query;
|
||||||
|
|
||||||
|
use ProVM\Concept\Database\Query;
|
||||||
|
|
||||||
|
interface Delete extends Query
|
||||||
|
{
|
||||||
|
public function from(string $table): Delete;
|
||||||
|
public function where(array $conditions): Delete;
|
||||||
|
}
|
12
src/Concept/Database/Query/Insert.php
Normal file
12
src/Concept/Database/Query/Insert.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
namespace ProVM\Concept\Database\Query;
|
||||||
|
|
||||||
|
use ProVM\Concept\Database\Query;
|
||||||
|
|
||||||
|
interface Insert extends Query
|
||||||
|
{
|
||||||
|
public function into(string $table): Insert;
|
||||||
|
public function columns(array $columns): Insert;
|
||||||
|
public function values(array $values): Insert;
|
||||||
|
public function select(Select $select): Insert;
|
||||||
|
}
|
15
src/Concept/Database/Query/Select.php
Normal file
15
src/Concept/Database/Query/Select.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace ProVM\Concept\Database\Query;
|
||||||
|
|
||||||
|
use ProVM\Concept\Database\Query;
|
||||||
|
|
||||||
|
interface Select extends Query
|
||||||
|
{
|
||||||
|
public function select(array $columns = ['*']): Select;
|
||||||
|
public function from(string $table): Select;
|
||||||
|
public function joins(array $joins): Select;
|
||||||
|
public function where(array $conditions): Select;
|
||||||
|
public function groupBy(array $grouping): Select;
|
||||||
|
public function having(array $having): Select;
|
||||||
|
public function orderBy(array $ordering): Select;
|
||||||
|
}
|
11
src/Concept/Database/Query/Update.php
Normal file
11
src/Concept/Database/Query/Update.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
namespace ProVM\Concept\Database\Query;
|
||||||
|
|
||||||
|
use ProVM\Concept\Database\Query;
|
||||||
|
|
||||||
|
interface Update extends Query
|
||||||
|
{
|
||||||
|
public function table(string $table): Update;
|
||||||
|
public function set(array $value_pairs): Update;
|
||||||
|
public function where(array $conditions): Update;
|
||||||
|
}
|
15
src/Concept/Database/QueryBuilder.php
Normal file
15
src/Concept/Database/QueryBuilder.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace ProVM\Concept\Database;
|
||||||
|
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
|
use ProVM\Concept\Database\Query\{Delete,Insert,Select,Update};
|
||||||
|
|
||||||
|
interface QueryBuilder
|
||||||
|
{
|
||||||
|
public function setContainer(ContainerInterface $container): QueryBuilder;
|
||||||
|
public function getContainer(): ContainerInterface;
|
||||||
|
public function select(array $columns = ['*']): Select;
|
||||||
|
public function insert(string $table): Insert;
|
||||||
|
public function update(string $table): Update;
|
||||||
|
public function delete(string $table): Delete;
|
||||||
|
}
|
Reference in New Issue
Block a user