From 1e672d3e308451f2b964f290be830520bf9ce4a2 Mon Sep 17 00:00:00 2001 From: Link1515 Date: Wed, 27 Mar 2024 11:08:38 +0800 Subject: [PATCH] update READMD.md --- README.md | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index d1c9b40..68a4c33 100644 --- a/README.md +++ b/README.md @@ -37,23 +37,20 @@ DB::PDO(?string $id): PDO; The BaseORM class has some common methods for creating, querying, updating and deleting. In simple applications, stataic methods can be called directly for specified table operation. ```php -/** - * options: - * { - * page: number|string - * perPage: number|string - * orderBy: string|array - * } - * - * ex (default value): - * [ - * 'page' => 1, - * 'perPage' => 20, - * 'orderBy' => 'id ASC' - * ] - */ +// options +// - page (int) +// - perPage (int) +// - orderBy (string|array) +// default value +// $options = [ +// 'page' => 1, +// 'perPage' => 20, +// 'orderBy' => 'id ASC' +// ] BaseORM::getAllForTable(string $tableName, ?array $columns = null, ?array $options): array; +BaseORM::getCountForTable(string $tableName): int; + BaseORM::getByIdForTable(string $tableName, int|string $id, ?array $columns = null): array|null; BaseORM::createForTable(string $tableName, array $data): bool; @@ -107,7 +104,7 @@ BaseORM::getAllForTable('users', ['name', 'phone']); BaseORM::getAllForTable('users', ['name' => 'username', 'phone' => 'cellphone']); // query all and set pagination BaseORM::getAllForTable('users', null, [ - 'page' => 1, + 'page' => 2, 'perPage' => 30 ]); // query all and order by @@ -115,6 +112,8 @@ BaseORM::getAllForTable('users', null, [ 'orderBy' => ['department_id DESC', 'id ASC'], ]); +BaseORM::getCountForTable('users'); + // query by id BaseORM::getByIdForTable('users', 1); // query by id and specified field @@ -141,6 +140,8 @@ In this case, you need to get the instance by getInstance() method and operate o ```php getAll(?array $columns = null, ?array $options): array; +getCount(): int; + getById(int|string $id, ?int $columns = null): array|null; create(array $data): bool;