GithubHelp home page GithubHelp logo

使用ES2015规范 about onela HOT 1 CLOSED

huanghe2015 avatar huanghe2015 commented on August 18, 2024
使用ES2015规范

from onela.

Comments (1)

zouwei avatar zouwei commented on August 18, 2024

感谢支持
v2.*版本已经开发接近尾声了,近期将会发布
新版语法将会更加简洁,使用面向对象来编程,代码更加清晰。

举个例子,在新版本中,对事务处理代码会非常简洁(代码逻辑部分示例,版本暂未发布)。

ToDoManager.transaction().then(t => {
    // 先新增一条记录
    ToDoManager.insertEntity({
            "id": "123",
            "content": "测试"
        }, {transaction: t})
        .then(data=> {
            // 再对新增的记录执行修改
            return ToDoManager.updateEntity({
                "update": [
                    {"key": "content", "value": "执行修改测试", "operator": "replace"}    // 修改了content字段
                ],
                "where": [
                    {"logic": "and", "key": "id", operator: "=", "value": "123"}
                ]
            }, {transaction: t});
        })
        .then(data => {
            // 事务提交
            t.commit(() => {  t.release(); });
        })
        .catch(ex => {
            console.log('事务异常回滚', ex.message);
            // 事务回滚
            t.rollback(() => { t.release(); });
        });
});```

from onela.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.