Skip to content

Instantly share code, notes, and snippets.

@tynrare
Last active April 11, 2024 01:29
Show Gist options
  • Save tynrare/ce396aa6e09cc1406eb788fe84054002 to your computer and use it in GitHub Desktop.
Save tynrare/ce396aa6e09cc1406eb788fe84054002 to your computer and use it in GitHub Desktop.
log-tim_dim-220615

-| 21:58 - "Ответ: для разгулки времени."

fastest-validator

arangodb sql-aql-comparison

![[Pasted image 20220615215046.png]]

![[module.js]]

const deleteTransaction = function(params){

    const { collection, key } = params;

    const node = db._query(`

        FOR doc IN @@collection

        FILTER doc._key == @key

        RETURN doc`,

    { '@collection':collection, key }).toArray();

    if(node.length === 0) throw new Error('Node not found');

  

    const { left, right, catalog } = node[0];

    const d = right - left + 1;

  

    db._query(`

        FOR doc IN @@collection

        FILTER doc.catalog == @catalog AND doc.left >= @left AND doc.right <= @right

        REMOVE doc IN @@collection`,

        { '@collection':collection, left, right, catalog });

  

    db._query(`

        FOR doc IN @@collection FILTER doc.catalog == @catalog AND doc.right > @right

        UPDATE doc WITH { right: doc.right - @d } IN @@collection`,

        { '@collection':collection, d, right, catalog });

  

    db._query(`

        FOR doc IN @@collection FILTER doc.catalog == @catalog AND doc.left > @right

        UPDATE doc WITH { left: doc.left - @d } IN @@collection`,

        { '@collection':collection, d, right, catalog });

  

    return true;

}

-| 21:49 - "Вопрос: зачем существует существующее?"

montage `ls` -tile 2x3 -background none -geometry 128x128+64+64 tile.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment