Facturacion
This commit is contained in:
33
app/common/Define/Query/Builder.php
Normal file
33
app/common/Define/Query/Builder.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace Incoviba\Common\Define\Query;
|
||||
|
||||
interface Builder
|
||||
{
|
||||
/**
|
||||
* @param string $table_name
|
||||
* @return Create
|
||||
*/
|
||||
public function create(string $table_name): Create;
|
||||
|
||||
/**
|
||||
* @param string|array $columns
|
||||
* @return Select
|
||||
*/
|
||||
public function select(string|array $columns = '*'): Select;
|
||||
|
||||
/**
|
||||
* @return Insert
|
||||
*/
|
||||
public function insert(): Insert;
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @return Update
|
||||
*/
|
||||
public function update(string $table): Update;
|
||||
|
||||
/**
|
||||
* @return Delete
|
||||
*/
|
||||
public function delete(): Delete;
|
||||
}
|
31
app/common/Define/Query/Create.php
Normal file
31
app/common/Define/Query/Create.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace Incoviba\Common\Define\Query;
|
||||
|
||||
use Incoviba\Common\Define;
|
||||
|
||||
interface Create extends Define\Query
|
||||
{
|
||||
/**
|
||||
* @param string $name
|
||||
* @return Create
|
||||
*/
|
||||
public function table(string $name): Create;
|
||||
|
||||
/**
|
||||
* @param string|Create\CreateDefinition|array $create_definitions
|
||||
* @return Create
|
||||
*/
|
||||
public function definitions(string|Create\CreateDefinition|array $create_definitions): Create;
|
||||
|
||||
/**
|
||||
* @param string|array $table_options
|
||||
* @return Create
|
||||
*/
|
||||
public function options(string|array $table_options): Create;
|
||||
|
||||
/**
|
||||
* @param string|array $partition_options
|
||||
* @return Create
|
||||
*/
|
||||
public function partition(string|array $partition_options): Create;
|
||||
}
|
59
app/common/Define/Query/Create/CreateDefinition.php
Normal file
59
app/common/Define/Query/Create/CreateDefinition.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace Incoviba\Common\Define\Query\Create;
|
||||
|
||||
interface CreateDefinition
|
||||
{
|
||||
const RESTRICT = 0;
|
||||
const CASCADE = 1;
|
||||
const SET_NULL = 2;
|
||||
const NO_ACTION = 3;
|
||||
const SET_DEFAULT = 4;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return CreateDefinition
|
||||
*/
|
||||
public function name(string $name): CreateDefinition;
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param int|null $size
|
||||
* @return CreateDefinition
|
||||
*/
|
||||
public function type(string $type, ?int $size = null): CreateDefinition;
|
||||
|
||||
/**
|
||||
* @return CreateDefinition
|
||||
*/
|
||||
public function primary(): CreateDefinition;
|
||||
|
||||
/**
|
||||
* @return CreateDefinition
|
||||
*/
|
||||
public function autoIncrement(): CreateDefinition;
|
||||
|
||||
/**
|
||||
* @return CreateDefinition
|
||||
*/
|
||||
public function unsigned(): CreateDefinition;
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return CreateDefinition
|
||||
*/
|
||||
public function default(mixed $value): CreateDefinition;
|
||||
|
||||
/**
|
||||
* @param string $reference_table
|
||||
* @param string $reference_column
|
||||
* @param int $on_delete
|
||||
* @param int $on_update
|
||||
* @return CreateDefinition
|
||||
*/
|
||||
public function foreign(string $reference_table, string $reference_column = 'id', int $on_delete = CreateDefinition::CASCADE, int $on_update = CreateDefinition::CASCADE): CreateDefinition;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString(): string;
|
||||
}
|
12
app/common/Define/Query/Delete.php
Normal file
12
app/common/Define/Query/Delete.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace Incoviba\Common\Define\Query;
|
||||
|
||||
use Incoviba\Common\Define;
|
||||
|
||||
interface Delete extends Define\Query
|
||||
{
|
||||
public function from(string $table): Delete;
|
||||
public function where(string|array $conditions): Delete;
|
||||
public function order(string|array $sorting): Delete;
|
||||
public function limit(int $limit): Delete;
|
||||
}
|
32
app/common/Define/Query/Insert.php
Normal file
32
app/common/Define/Query/Insert.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace Incoviba\Common\Define\Query;
|
||||
|
||||
use Incoviba\Common\Define;
|
||||
|
||||
interface Insert extends Define\Query
|
||||
{
|
||||
/**
|
||||
* @param string $table
|
||||
* @param array|null $columns
|
||||
* @return Insert
|
||||
*/
|
||||
public function into(string $table, ?array $columns = null): Insert;
|
||||
|
||||
/**
|
||||
* @param array $columns
|
||||
* @return Insert
|
||||
*/
|
||||
public function columns(array $columns): Insert;
|
||||
|
||||
/**
|
||||
* @param array $values
|
||||
* @return Insert
|
||||
*/
|
||||
public function values(array $values): Insert;
|
||||
|
||||
/**
|
||||
* @param Select $select
|
||||
* @return Insert
|
||||
*/
|
||||
public function select(Select $select): Insert;
|
||||
}
|
62
app/common/Define/Query/Select.php
Normal file
62
app/common/Define/Query/Select.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
namespace Incoviba\Common\Define\Query;
|
||||
|
||||
use Incoviba\Common\Define;
|
||||
|
||||
interface Select extends Define\Query
|
||||
{
|
||||
/**
|
||||
* @param string|array $expressions
|
||||
* @return Select
|
||||
*/
|
||||
public function columns(string|array $expressions): Select;
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @return Select
|
||||
*/
|
||||
public function from(string $table): Select;
|
||||
|
||||
/**
|
||||
* @param string|array $joins
|
||||
* @return Select
|
||||
*/
|
||||
public function joined(string|array $joins): Select;
|
||||
|
||||
/**
|
||||
* @param string|array $conditions
|
||||
* @return Select
|
||||
*/
|
||||
public function where(string|array $conditions): Select;
|
||||
|
||||
/**
|
||||
* @param string|array $grouping
|
||||
* @return Select
|
||||
*/
|
||||
public function group(string|array $grouping): Select;
|
||||
|
||||
/**
|
||||
* @param string|array $conditions
|
||||
* @return Select
|
||||
*/
|
||||
public function having(string|array $conditions): Select;
|
||||
|
||||
/**
|
||||
* @param string|array $sorting
|
||||
* @return Select
|
||||
*/
|
||||
public function order(string|array $sorting): Select;
|
||||
|
||||
/**
|
||||
* @param int $limit
|
||||
* @param int|null $offset
|
||||
* @return Select
|
||||
*/
|
||||
public function limit(int $limit, ?int $offset = null): Select;
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
* @return Select
|
||||
*/
|
||||
public function offset(int $offset): Select;
|
||||
}
|
13
app/common/Define/Query/Update.php
Normal file
13
app/common/Define/Query/Update.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Incoviba\Common\Define\Query;
|
||||
|
||||
use Incoviba\Common\Define;
|
||||
|
||||
interface Update extends Define\Query
|
||||
{
|
||||
public function table(string $table): Update;
|
||||
public function set(string|array $column_pairs): Update;
|
||||
public function where(string|array $conditions): Update;
|
||||
public function order(string|array $ordering): Update;
|
||||
public function limit(int $limit): Update;
|
||||
}
|
Reference in New Issue
Block a user