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

feat: allow transactions to be enabled on a resource-by-resource basis. #95

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jimsynz
Copy link
Contributor

@jimsynz jimsynz commented Oct 14, 2024

This is a work in progress.

@jimsynz jimsynz force-pushed the feat/fine-grained-transaction-control branch from 40971dc to e263f43 Compare October 17, 2024 05:44
@jimsynz jimsynz force-pushed the feat/fine-grained-transaction-control branch from 9597360 to 2ed5ab9 Compare October 20, 2024 20:30
@jimsynz jimsynz force-pushed the feat/fine-grained-transaction-control branch from 2ed5ab9 to 766edf9 Compare October 20, 2024 20:34
@@ -446,6 +483,11 @@ defmodule AshSqlite.DataLayer do
def can?(_, {:sort, _}), do: true
def can?(_, _), do: false

@impl true
def in_transaction?(resource) do
AshSqlite.DataLayer.Info.repo(resource, :mutate).in_transaction?()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mentioned that this wasn't working the way you expected it to. Have you confirmed that in_transaction?/0 works with Sqlite in general?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also don't forget to add a rollback callback.

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

Successfully merging this pull request may close these issues.

2 participants