Git Product home page Git Product logo

sqlite3unity3d_ts's Introduction

license

它是什么?

  • 简介

    基于Sqlite3开源数据库, 使用typescript语言开发. 搭配puerts为Unity平台提供简单易用丶高效性能的对象存储.

  • Sqlite3简介

    Sqlite3是遵守ACID的关系型数据库, 小巧丶嵌入式丶无需安装. 能够跟很多种语言相结合, 运行时占有资源非常低.

  • 原项目

    此项目基于SQLite4Unity3d

如何使用?

  • 数据类
  class Data {
      @Column("number")
      public id: number;
      @Column("string")
      public name: string;
      @Column("number")
      public age: number;
      @Column("number")
      public sex: number;
  }
  • 创建并打开连接
    let conn = new DBConnection("db path");
    conn.open();
  • 表操作
    //创建表
    conn.createTable(Data);
    //清空表
    conn.clearTable(Data);
    //删除表
    conn.dropTable(Data);
  • 插入/更新记录
    let data = new Data();
    //直接插入
    conn.insert(data);
    //条件更新或插入数据
    //注:基于字符串解析, 无法直接获取data.id的值, 需要通过对象传入
    let id = data.id;
    let ret = conn.table(Data)
        .where(o => o.id == id && id != 0, { id })
        .updateOrInsert(data);
  • 查询记录
    let queryAll: Data[] = conn.table(Data)
        .query();
    let queryBetween: Data[] = conn.table(Data)
        .between(o => o.age, "20", "30")
        .query();
  • 删除记录
    let ret = conn.table(Data)
        .where(o => o.id == 10)
        .delete();

特点

  • 无需手动构建SQL语句
  • 运行时构建对象和数据表信息
  • 有限的支持Lambda表达式解析(字符串解析)

性能测试

  • 暂无

说明

  • 此项目创建于 2020/10/30 , 尚不明确存在的BUG和性能问题, 未来将会陆续修复丶优化此项目.
  • 如果您在使用中遇到任何问题, 请与我联系
  • [联系邮箱]: [email protected]

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.