This update took me quite a bit more time than I initially expected. Anyway, I have done some refactoring work to the original code, and thought it would be nice to document the changes. Overall, most of the changes involved the refactoring of function names. I am not sure if this would stick, but I am quite satisfied for now.
Considering certain statements such as insert, update and delete statement should remain the same most of the time, I have made the library to generate them automatically. However, they can be rewritten for whatever reason though. For this to work properly, a new option is introduced to the schema, as shown below:
"data_type": "character varying",
Simply add in a new option named “insert”, and set it to true, then the library will generate appropriate insert and update statement.
The basic concept is still similar, however most of the function call has changed. For instance, to create a generator,
$generator = \coolsilon\database\relation_generator($pdo, json_reader());
Executing a statement is now simply
$statement = \coolsilon\database\statement_execute($statement, $data);
For form library, the init function is now
$form = \coolsilon\form\init(json_decode($file_of_form_schema, TRUE));
Reading the input is now
$input = \coolsilon\form\input_read($_POST);
Other things remains the same for now, but I probably would revise them again in future. I have tagged the current state as version 0.1. While I am sort of happy with the current state, I am working on adding new widgets to the library. After all the basic features are in place, I would probably start testing them properly.