Get a record
Example DB Table
smartPanda.mdh.brand
CREATE TABLE `brand`
(
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`logo` text,
`logo_url` varchar(255) DEFAULT NULL,
`website` varchar(255) DEFAULT NULL,
`disabled` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);
Gets a record based on the ID or unique identifier specified in the method name
db.schema.table.get*
Gets a record based on the ID or unique identifier specified in the method name and returns an object 。
API getBy*
Example Request
{
"method": "smartPanda.mdh.brand.getById",
"params": 1
}
Example Response
{
"id": 1,
"name": "Brand A",
"logo": "logo_a.png",
"logoUrl": "http://example.com/logo_a.png",
"website": "http://example.com/brand_a",
"disabled": 0
}
Script getBy*
Example Code
var result = luwak.dao("smartPanda.mdh.brand.getById", 1);
Example Result
{
id: 1,
name: "Brand A",
logo: "logo_a.png",
logoUrl: "http://example.com/logo_a.png",
website: "http://example.com/brand_a",
disabled: 0
}