2025-01-24 13:26:48 +01:00
|
|
|
<?php
|
|
|
|
namespace DatabaseHelper\interfaces;
|
|
|
|
|
2025-01-27 19:35:17 +01:00
|
|
|
interface InsertionBuilder
|
2025-01-24 13:26:48 +01:00
|
|
|
{
|
2025-02-03 17:44:52 +01:00
|
|
|
/**
|
|
|
|
* Initializes an InsertionBuilder with a table blueprint.
|
|
|
|
* @param TableBlueprint $table Table to insert data into.
|
|
|
|
*/
|
|
|
|
public function __construct(TableBlueprint $table);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Specifies a single column-value pair for insertion.
|
|
|
|
* @param string $col Column name to insert into.
|
|
|
|
* @param mixed $val Value to insert.
|
|
|
|
* @return InsertionBuilder Current instance for method chaining.
|
|
|
|
*/
|
|
|
|
public function data(string $col, mixed $val): InsertionBuilder;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Marks the current row as complete and finalizes it for insertion.
|
|
|
|
* After calling done(), only finalized rows will be inserted.
|
|
|
|
* @return InsertionBuilder Current instance for method chaining.
|
|
|
|
*/
|
|
|
|
public function done(): InsertionBuilder;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Executes the insert query.
|
|
|
|
* Automatically determines whether to insert a single row or batch insert.
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function insert(): void;
|
|
|
|
}
|
|
|
|
|