Implementing WebSockets in Rust
Recently, I needed WebSockets in my side project. I will share how I implemented it, what I learned.
<?php
$table = data_get_table('college_application');
$save_data = array(
'student_id' => SOME_DATA,
'college_id' => SOME_DATA,
'application' => SOME_DATA,
'assigner' => SOME_DATA,
);
$table->handler()->save($save_data);
This will create new entry with given data.
<?php
$table = data_get_table('college_application');
$output = $table->handler()->load(array(
'student_id' => SOME_DATA,
'college_id' => SOME_DATA,
));
This will fetch all entries where student_id
and college_id
is equal to the given data. Suppose you want to add an OR condition for values in college_id
:
<?php
$table = data_get_table('college_application');
$output = $table->handler()->load(array(
'student_id' => SOME_DATA,
'college_id' => array(SOME_DATA1, SOME_DATA2),
));
This will fetch all rows where college_id
is either SOME_DATA1
or SOME_DATA2
and student_id
is SOME_DATA
<?php
$table = data_get_table('college_application');
$update_data = array(
'student_id' => SOME_DATA,
'college_id' => SOME_DATA,
'application' => SOME_DATA,
'assigner' => SOME_DATA,
);
$table->handler()->update($update_data, array('student_id', 'college_id'));
This will update all entries where student_id
and college_id
equals to the given data.
<?php
$table = data_get_table('college_application');
$delete_data = array(
'student_id' => SOME_DATA,
'college_id' => SOME_DATA,
);
$table->handler()->delete($delete_data);
This will delete all entries where student_id
and college_id
equals to the the given data.
That’s all.. I hope everything is clear to you.
Leave a Comment