Giter Club home page Giter Club logo

xtorm's Introduction

Xtorm

About

This is a database API specifically for MySQL's (8.0.15+) X Protocol API. It radically differs from most database APIs as it does not execute a statement at a time, but rather a complete transaction/unit of work.

This means

  • Reduced network roundtrips, only a single net.Conn Write() per unit of work

  • Transaction duration times minimised

  • No client connection state, as no tracking of

    • open transactions
    • prepared statements

    Reduces complexity when using a pool of connections.

  • Simplified error handling, only have to check the transaction commit succeed.

  • Preparing statements and executing within the same unit of work.

Error Handling

MySQL error handling is managed by MySQL expectation blocks. By opening a expectation block with the expectation of no errors, MySQL will fail all remaining statements in the block as soon as an error has occurred.

So the expected typical structure of a unit of work

  1. Open expectation block
  2. Prepare statements
  3. Begin transaction
  4. Insertions, updates, deletions, prepared statement executions, parameterised statement executions
  5. Commit transaction
  6. Close expectation block

If an error occurs in steps 1-4 then the commit will be skipped returning an error "Expectation failed: no_error". If the commit fails, then that will return an error.

TODO

  • SELECTs. No SELECT support atm.
  • Save IDs from LAST_INSERT_ID() into variables so can insert rows into multiple tables in one UoW. No protobuf method using mysql's xprotocol for SET instructions so this would have to be regular SQL & StmtExecute. Expr Variables are currently not supported in MySQL 8.0.27. "ERROR 5153 (HY000): Mysqlx::Expr::Expr::VARIABLE is not supported yet"
  • More/better pool implementations.

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.