Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to delete jqplay links? #107

Open
MudraLadani opened this issue Mar 15, 2021 · 3 comments
Open

How to delete jqplay links? #107

MudraLadani opened this issue Mar 15, 2021 · 3 comments

Comments

@MudraLadani
Copy link

Hello,

I created a few jqplay links. I want to delete those links.

How can I accomplish that?

@elpreguntador
Copy link

elpreguntador commented Apr 23, 2021

Hello,

Same question.

It would also be interesting to include at least a "noindex" meta tag

@mngau
Copy link

mngau commented Apr 29, 2022

Hi, same query here, I'd like to delete jqplay links I have created also.

@loganmarchione
Copy link

loganmarchione commented May 12, 2023

I'm no DBA, but couldn't you run a DELETE statement in the database? There are two tables.

In the example below, I have two snippets and I want to delete the first one. The id is 1 and the slug is 6hLv1cbafHE.

jqplay-db=# SELECT * FROM snippets;
 id |    slug     |                      j                      |  q   |                                                                 o                                                                  |          created_at           
----+-------------+---------------------------------------------+------+------------------------------------------------------------------------------------------------------------------------------------+-------------------------------
  1 | 6hLv1cbafHE | { "foo": { "bar": { "baz": 123 } } }        | .    | [{"name": "slurp", "enabled": false}, {"name": "null-input", "enabled": false}, {"name": "compact-output", "enabled": false}, {"na.| 2023-05-12 01:50:08.049929+00
    |             |                                             |      |.me": "raw-input", "enabled": false}, {"name": "raw-output", "enabled": false}, {"name": "sort-keys", "enabled": false}]            | 
  2 | 6Mm_RDQnBFC | {"foo": 42, "bar": "less interesting data"} | .foo | [{"name": "slurp", "enabled": false}, {"name": "null-input", "enabled": false}, {"name": "compact-output", "enabled": false}, {"na.| 2023-05-12 01:57:54.43762+00
    |             |                                             |      |.me": "raw-input", "enabled": false}, {"name": "raw-output", "enabled": false}, {"name": "sort-keys", "enabled": false}]            | 
(2 rows)

jqplay-db=# SELECT * FROM snippets_id_seq;
 last_value | log_cnt | is_called 
------------+---------+-----------
          2 |      32 | t
(1 row)

Run a SELECT first.

SELECT * FROM snippets WHERE slug = '6hLv1cbafHE';

Then run a DELETE.

DELETE FROM snippets WHERE slug = '6hLv1cbafHE' RETURNING *;

The first snippet is gone, and the new snippets continue to increment their IDs. I don't think this would be an issue, but I don't know enough about SQL to be sure. Regardless, this is what I'm doing and it seems to work 🤷.

jqplay-db=# SELECT * FROM snippets;
 id |    slug     |                      j                      |          q          |                                                          o                                                          |          created_at           
----+-------------+---------------------------------------------+---------------------+---------------------------------------------------------------------------------------------------------------------+-------------------------------
  2 | 6Mm_RDQnBFC | {"foo": 42, "bar": "less interesting data"} | .foo                | [{"name": "slurp", "enabled": false}, {"name": "null-input", "enabled": false}, {"name": "compact-output", "enabled.| 2023-05-12 01:57:54.43762+00
    |             |                                             |                     |.": false}, {"name": "raw-input", "enabled": false}, {"name": "raw-output", "enabled": false}, {"name": "sort-keys",.| 
    |             |                                             |                     |. "enabled": false}]                                                                                                 | 
  3 | -HliBSll-7z | {"abc": 1, "abcd": 2, "Foo": 3}             | keys                | [{"name": "slurp", "enabled": false}, {"name": "null-input", "enabled": false}, {"name": "compact-output", "enabled.| 2023-05-12 02:14:45.195236+00
    |             |                                             |                     |.": false}, {"name": "raw-input", "enabled": false}, {"name": "raw-output", "enabled": false}, {"name": "sort-keys",.| 
    |             |                                             |                     |. "enabled": false}]                                                                                                 | 
  4 | VOpN1OUW76S | [1,5,3,0,7]                                 | map(select(. >= 2)) | [{"name": "slurp", "enabled": false}, {"name": "null-input", "enabled": false}, {"name": "compact-output", "enabled.| 2023-05-12 02:16:58.514398+00
    |             |                                             |                     |.": false}, {"name": "raw-input", "enabled": false}, {"name": "raw-output", "enabled": false}, {"name": "sort-keys",.| 
    |             |                                             |                     |. "enabled": false}]                                                                                                 | 
(3 rows)

jqplay-db=# SELECT * FROM snippets_id_seq;
 last_value | log_cnt | is_called 
------------+---------+-----------
          4 |      31 | t
(1 row)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants