Reorder and new queries, also change to Query/Builder

This commit is contained in:
2023-02-28 23:47:02 -03:00
parent 849d42ea57
commit d266008224
33 changed files with 839 additions and 612 deletions

View File

@ -0,0 +1,14 @@
<?php
namespace ProVM\Concept\Database\Query;
interface Builder
{
public function select(array|string $columns = '*'): Select;
public function insert(?string $table = null): Insert;
public function update(?string $table = null): Update;
public function delete(?string $table = null): Delete;
public function create(?string $table = null): Create;
public function truncate(?string $table = null): Truncate;
public function drop(?string $table = null): Drop;
}

View File

@ -0,0 +1,10 @@
<?php
namespace ProVM\Concept\Database\Query;
use ProVM\Concept\Database\Query;
interface Create extends Query
{
public function table(string $table): Create;
public function columns(array|string $columns): Create;
}

View File

@ -6,5 +6,5 @@ use ProVM\Concept\Database\Query;
interface Delete extends Query
{
public function from(string $table): Delete;
public function where(array $conditions): Delete;
public function where(array|string $conditions): Delete;
}

View File

@ -0,0 +1,9 @@
<?php
namespace ProVM\Concept\Database\Query;
use ProVM\Concept\Database\Query;
interface Drop extends Query
{
public function table(string $table): Drop;
}

View File

@ -6,7 +6,7 @@ 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;
public function columns(array|string $columns): Insert;
public function values(array|string $values): Insert;
public function select(Select|string $select): Insert;
}

View File

@ -5,11 +5,11 @@ use ProVM\Concept\Database\Query;
interface Select extends Query
{
public function select(array $columns = ['*']): Select;
public function columns(array|string $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;
public function joined(array|string $joins): Select;
public function where(array|string $conditions): Select;
public function groupBy(array|string $grouping): Select;
public function having(array|string $having): Select;
public function orderBy(array|string $ordering): Select;
}

View File

@ -0,0 +1,9 @@
<?php
namespace ProVM\Concept\Database\Query;
use ProVM\Concept\Database\Query;
interface Truncate extends Query
{
public function table(string $table): Truncate;
}

View File

@ -6,6 +6,6 @@ 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;
public function set(array|string $value_pairs): Update;
public function where(array|string $conditions): Update;
}