CRUD DELETE

Delete data from your database.

Using node/bun:

import datasquirel from "@moduletrace/datasquirel";

datasquirel.api
    .crud({
        database: "social_network",
        table: "users",
        key: process.env.FULL_ACCESS_API_KEY,
        params: {
            action: "delete",
            targetId: 1,
        },
    })
    .then((response) => {
        console.log(response);
    });

Using curl:

CURL -X DELETE https://datasquirel.com/api/v1/social_network/users/1 \
-H "Authorization:FULL_ACCESS_API_KEY"


Resulting SQL:

DELETE FROM users WHERE id = 1;

Return Response:

{
    success: true,
    payload: {
        affectedRows: 1,
        insertId: 0,
        info: "",
        serverStatus: 2,
        warningStatus: 0,
    },
    "queryRes": {
        "string": "DELETE FROM users WHERE id = 1",
        "values": []
    }
}