import-data.js 759 B

12345678910111213141516171819202122232425
  1. const { CloudQuery, CloudObject } = require("../lib/ncloud");
  2. //testCRUD()
  3. testQuery()
  4. //查询
  5. async function testQuery(){
  6. let query = new CloudQuery("ChatPartner")
  7. let list = await query.find();
  8. console.log(list)
  9. }
  10. async function testCRUD(){
  11. // 基本的增删查改测试
  12. let query = new CloudQuery("ChatPartner")
  13. let chatpartnerList = await query.find();
  14. console.log("chatpartnerList count",chatpartnerList?.length)
  15. let newChatPartner = new CloudObject("ChatPartner")
  16. newChatPartner.set({"name":"123"})
  17. newChatPartner = await newChatPartner.save(newChatPartner)
  18. console.log("newChatPartner",newChatPartner)
  19. await newChatPartner.destory()
  20. console.log("newChatPartner 已删除",newChatPartner)
  21. }