const { CloudQuery, CloudObject } = require("../lib/ncloud");
// testCRUD()
testQuery()
async function testQuery(){
    let query = new CloudQuery("test")
    query.equalTo("gender","男")
     query.greaterThanAndEqualTo("age",20)
    query.lessThan("age",25)
     let list = await query.find();
     console.log(list)
}

async function testCRUD(){
    // 基本的增删查改测试
    let query = new CloudQuery("Doctor")
    let doctorList = await query.find();
    console.log("doctorList count",doctorList?.length)

    let newDoctor = new CloudObject("Doctor")
    newDoctor.set({"name":"123"})
    
    newDoctor = await newDoctor.save(newDoctor)
    console.log("newDoctor",newDoctor)

    await newDoctor.destory()
    console.log("newDoctor 已删除",newDoctor)
}