Medoo 1.1
We are happy to announced that Medoo v1.1 is now released.
This version is included some awesome changes and useful features.
- New feature - data mapping
- New feature - table alias
- New
ORDER
syntax (Incompatible for old version) - Improve performance & bug fixes
Data Mapping
$data = $database->select("post", [
"[>]account" => ["user_id"]
], [
"post.post_id",
"post.content",
"userData" => [
"account.user_id",
"account.email",
"meta" => [
"account.location",
"account.gender"
]
]
], [
"LIMIT" => [0, 2]
]);
echo json_encode($data);
// Outputed data
[
{
post_id: "1",
content: "Hello world!",
userData: {
user_id: "1",
email: "[email protected]",
meta: {
location: "New York",
gender: "male"
}
}
},
{
post_id: "2",
content: "Hey everyone",
userData: {
user_id: "2",
email: "[email protected]",
meta: {
location: "London",
gender: "female"
}
}
}
]
New ORDER syntax (Incompatible for old version)
$database->select("account", "user_id", [
// Single condition
"ORDER" => "user_id",
// Multiple condition
"ORDER" => [
// Order by column with sorting by customized order.
"user_id" => [43, 12, 57, 98, 144, 1],
// Order by column
"register_date",
// Order by column with descending sorting
"profile_id" => "DESC",
// Order by column with ascending sorting
"date" => "ASC"
]
]);