Example #1
0
async def insert_tx(conn: SAConn, tx: Tx) -> bool:
    try:
        _tx = object_as_dict(tx)
        await conn.execute(insert(Tx).values(**_tx))
        return True
    except Exception as ex:
        return False
Example #2
0
async def insert_order(conn: SAConn, order: Order):
    try:
        _order = object_as_dict(order)
        await conn.execute(insert(Order).values(**_order))
        return True
    except Exception as ex:
        return False
Example #3
0
async def update_tx(conn: SAConn, tx: Tx):
    _tx = {}
    for k, v in object_as_dict(tx).items():
        if v != None:
            _tx[k] = v
    q = update(Tx).values(**_tx).where(Tx.id == tx.id)
    return await conn.execute(q)
Example #4
0
async def update_tx(conn: SAConn, tx: Tx):
    _tx = object_as_dict(tx)
    q = update(Tx).values(**_tx).where(Tx.tx_id == tx.tx_id)
    return await conn.execute(q)