Skip to main content

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`)
);

Get a record and specify the field name

Define the method name and specify which field values ​​to return.

  • If one field is specified, the return value only contains the field literal value.
  • If multiple fields are specified, the return value is an object containing multiple fields.

API get*

Example Request

{
"method": "smartPanda.mdh.brand.getName",
"params": 1
}

Example Response

"Brand A"

Example Request

{
"method": "smartPanda.mdh.brand.getNameAndLogo",
"params": 1
}

Example Response

{
"logo": "logo_a.png",
"name": "Brand A"
}

Script get*

Example Code

var name = luwak.dao("smartPanda.mdh.brand.getName", 1);

var result = luwak.dao("smartPanda.mdh.brand.getNameAndLogo", 1);

API get*By*

Example Request

Script get*By*