The snippet library.
Small, practical examples. Search by task or narrow things down below.
Undo only the work after a savepoint
SQL: After committing the fixtures, roll back a trial change while keeping earlier work in the second transaction.
SQL✓ Tested
Undo only the work after a savepoint
SQL Server: After committing the fixtures, roll back a trial change while keeping earlier work in the second transaction.
SQL Server✓ Tested
Undo only the work after a savepoint
Postgres: After committing the fixtures, roll back a trial change while keeping earlier work in the second transaction.
Postgres✓ Tested
Undo only the work after a savepoint
SQLite: After committing the fixtures, roll back a trial change while keeping earlier work in the second transaction.
SQLite✓ Tested
Unpack a tuple with structured bindings
C++: Structured bindings give names to the parts of a returned compound value.
C++✓ Tested
Unstage a file while keeping its contents
Git: Unstage a file while keeping its contents inside the disposable repository created by the input setup.
Git✓ Tested
Unstage a file without losing edits
Return a staged change to the working tree.
restore✓ Tested
Update a JSON document with mutable nodes
C#: JsonNode permits targeted changes before serializing a document again.
C#✓ Tested
Update a JSON property
Create updated JSON text with JSON_MODIFY.
JSON_MODIFY✓ Tested
Update a nested object immutably
Update a nested object immutably with a small React component and explicit browser behavior.
React✓ Tested
Update a row on conflict
Use a primary key to insert or update one value.
upsert✓ Tested
Update a running count
Python: Change a variable after its initial value has been assigned.
Python✓ Tested