当前位置:网站首页>Adding, deleting, modifying and checking in low build code
Adding, deleting, modifying and checking in low build code
2022-06-25 00:06:00 【Low code preacher】
In daily teaching , People often ask , How to use this platform method , How to pass parameters . In this article, we will explain how to use the method of adding, deleting, modifying, and checking in the low-level code of micro build .
Data source method
After you create the data source , The platform will automatically generate corresponding methods .
Model methods are added respectively 、 Add multiple 、 Delete 、 Delete multiple 、 to update 、 Update multiple 、 Inquire about 、 Query list .
To use these platform methods, you must understand the input and output parameters of each method . The so-called input parameters are the parameters that you must pass in when calling , The so-called parameter output is the result returned after the call .
The new method
Generally, we need to pass the fields of the data source , For example, my grade data source has only one field , Grade name , Then you need to pass in the field of grade name when calling .
There are two ways to call the methods of the general data model , One is to call... In a component , One is to call... In a low code editor .
We usually use it in combination with the form container , For example, add a form container , You can choose to add a new scene , Set data source . The new scenario here refers to calling the new method .
This will save the value to the data source after you enter it in the text box .
The second method is to call... In the low code editor , The following code
export default async function({
event, data}) {
const result = await app.cloud.callModel({
name:'nj_popsnzw',
methodName:'wedaCreate',
params:{
njmc : ' In grade one '
}
})
}

After the method is defined, you can call... By defining a click event for the button 
Except the way you write code , We can also call platform methods directly , Pass on the reference 
Novices are mainly stuck in how to pass parameters when learning , In fact, it is the same as what we pass in the code params It's the same , It's just a visual way to transfer parameters , Remember to bind with expressions here 
Add multiple
You can add multiple items in batch at one time , Notice that our input parameter is an array 
We have not added more than one scenario in the form container , So you have to call... In code
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'nj_popsnzw',
methodName: 'wedaBatchCreate',
params: {
records: [
{
njmc: ' Batch grade one ' },
{
njmc: ' Batch grade 2 ' },
{
njmc: ' Batch third grade ' }
]
}
})
}
Some students may say , I can't understand what you are . Because the input parameter must be an object , there records It's the input of the method , The type is array , But why are there multiple objects in the array ? You can actually look at the documentation of cloud development , You can't do it just by looking at it .
Delete
Deletion can only be called through low code methods , The code is as follows
export default async function({
event, data}) {
const result = await app.cloud.callModel({
name:'nj_popsnzw',
methodName:'wedaDelete',
params:{
_id : '058dfefe62b50cb70a3d3053309efc79'
}
})
}
Delete multiple
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'nj_popsnzw',
methodName: 'wedaBatchDelete',
params: {
where: [
{
key: 'njmc',
rel: 'eq',
val: ' Batch grade one '
}
]
}
})
}
to update
Component calls are supported when updating , Low code calls are also supported . Component calls can use the form container 
To update, you must pass in a data ID . The same is true for code calls, which also need to pass in the data ID
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'nj_popsnzw',
methodName: 'wedaUpdate',
params: {
_id:'6d85a2b962b50bb60c5c73ad0271a82e',
njmc: ' In grade one 11'
}
})
}
Update multiple
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'nj_popsnzw',
methodName: 'wedaBatchUpdate',
params: {
record: {
njmc: ' Batch update '
},
where: [
{
key: 'njmc', rel: 'eq', val: ' In grade one ' }
]
}
})
}
Inquire about
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'nj_popsnzw',
methodName: 'wedaGetItem',
params: {
_id: '0ab5303b62b412680acbf05573660730'
}
})
console.log(result)
}
Query list
Query lists can be used in variables 、 Use in components 、 Use in low code . The following is how to use low code
export default async function ({
event, data }) {
const result = await app.cloud.callModel({
name: 'user_h4la7ee',
methodName: 'wedaGetRecords',
params: {
"where": [
{
"key": "openid",
"rel": "eq",
"val": app.dataset.state.openid
}
]
}, // Methods into the reference
});
}
summary
The method of using data source for low code is not complicated , I don't know how to construct the input parameter , This article lists the input parameters of each method in detail , Hope to bring a touch of light to your programming path .
边栏推荐
- Global and Chinese tetrahydrofurfuryl butyrate industry operation pattern and future prospect report 2022 ~ 2028
- 使用网络摄像头进行眼睛注视估计
- Hibernate学习3 - 自定义SQL
- canvas线条的动态效果
- Sitelock helps you with the top ten common website security risks
- ArcGIS加载免费在线历史影像作为底图(不需要插件)
- Development status and prospect trend forecast report of humic acid sodium industry in the world and China from 2022 to 2028
- Stm32f030f4 reading infrared remote control data
- Assessment of public finance of Jilin University in March of the 22nd spring -00091
- Nacos究竟是什么
猜你喜欢

颜色渐变梯度颜色集合

Do280openshift access control -- encryption and configmap

在滴滴和字节跳动干了 5年软件测试,太真实…

Canvas spiral style animation JS special effect

Tutorial details | how to edit and set the navigation function in the coolman system?

On the difficulty of developing large im instant messaging system

Fast pace? high pressure? VR panoramic Inn brings you a comfortable life

Interesting checkbox counters

∞ symbol line animation canvasjs special effect

One way 和two way ANOVA分析的区别是啥,以及如何使用SPSS或者prism进行统计分析
随机推荐
Dynamic effect of canvas lines
Hibernate learning 2 - lazy loading (delayed loading), dynamic SQL parameters, caching
Creative SVG ring clock JS effect
Investment analysis and prospect forecast report of global and Chinese octadecyl cyclopentanoate industry from 2022 to 2028
Development status and prospect trend forecast report of humic acid sodium industry in the world and China from 2022 to 2028
Today's sleep quality record 79 points
Fast pace? high pressure? VR panoramic Inn brings you a comfortable life
What exactly is Nacos
Collective example
Human body transformation vs digital Avatar
Ultra vires vulnerability & Logic vulnerability (hot) (VIII)
机器学习自学成才的十条戒律
canvas线条的动态效果
Difficult and miscellaneous problems: A Study on the phenomenon of text fuzziness caused by transform
Classic interview questions and answers for embedded engineers
SAP PA certificate for no birds, which can be tested by new peers
∞符号线条动画canvasjs特效
时间统一系统
节奏快?压力大?VR全景客栈带你体验安逸生活
Printf redirection of serial port under sw4stm32 (SW4)