Repository navigation
Expand file tree
/
Copy pathConnectionInterface.php
More file actions
executable file
·114 lines (94 loc) · 2.85 KB
/
Copy pathConnectionInterface.php
File metadata and controls
executable file
·114 lines (94 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Database;
use Closure;
use Generator;
use Hyperf\Database\Query\Builder;
use Hyperf\Database\Query\Expression;
interface ConnectionInterface
{
/**
* Begin a fluent query against a database table.
* @param Expression|string $table
*/
public function table($table): Builder;
/**
* Get a new raw query expression.
* @param mixed $value
*/
public function raw($value): Expression;
/**
* Run a select statement and return a single result.
*/
public function selectOne(string $query, array $bindings = [], bool $useReadPdo = true);
/**
* Run a select statement against the database.
*/
public function select(string $query, array $bindings = [], bool $useReadPdo = true): array;
/**
* Run a select statement against the database and returns a generator.
*/
public function cursor(string $query, array $bindings = [], bool $useReadPdo = true): Generator;
/**
* Run an insert statement against the database.
*/
public function insert(string $query, array $bindings = []): bool;
/**
* Run an update statement against the database.
*/
public function update(string $query, array $bindings = []): int;
/**
* Run a delete statement against the database.
*/
public function delete(string $query, array $bindings = []): int;
/**
* Execute an SQL statement and return the boolean result.
*/
public function statement(string $query, array $bindings = []): bool;
/**
* Run an SQL statement and get the number of rows affected.
*/
public function affectingStatement(string $query, array $bindings = []): int;
/**
* Run a raw, unprepared query against the PDO connection.
*/
public function unprepared(string $query): bool;
/**
* Prepare the query bindings for execution.
*/
public function prepareBindings(array $bindings): array;
/**
* Execute a Closure within a transaction.
*
* @throws \Throwable
*/
public function transaction(Closure $callback, int $attempts = 1);
/**
* Start a new database transaction.
*/
public function beginTransaction(): void;
/**
* Commit the active database transaction.
*/
public function commit(): void;
/**
* Rollback the active database transaction.
*/
public function rollBack(): void;
/**
* Get the number of active transactions.
*/
public function transactionLevel(): int;
/**
* Execute the given callback in "dry run" mode.
*/
public function pretend(Closure $callback): array;
}