xfoxfu / ZhuiAni.me

A platform for scraping, subscribing, downloading and watching animations based on torrents.
MIT License
2 stars 2 forks source link

APIs for Transactional Insertion #11

Closed xfoxfu closed 2 months ago

xfoxfu commented 1 year ago

It is common to have a pattern of:

  1. detect if a item with a specific link exists,
  2. if not,create a new item.

The two actions need to be wrapped into a transaction, which could be considered as conditional insertion, or to say upsert.

Such kind of APIs need to be provided directly, instead of letting developers write commit/rollback manually.

xfoxfu commented 1 year ago

Some ideas: