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

feature: add saga persistence layer #649

Merged
merged 6 commits into from
Feb 22, 2024

Conversation

ptyin
Copy link
Member

@ptyin ptyin commented Jan 19, 2024

What this PR does:
This PR involves the storage aspect of the state machine. The primary focus will be on creating SQL templates, with reference to the seata-engine-store module.

Which issue(s) this PR fixes:

Fixes #638

Special notes for your reviewer:
UTs are under the same directory as sources

db *sql.DB
}

func SelectOne[T any](db *sql.DB, sql string, fn ScanRows[T], args ...any) (T, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Generics are also used here, need to remove them?

Copy link
Member Author

Choose a reason for hiding this comment

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

I suggest we can keep this generic function. It maps the Rows to arbitrary type T, which I think it is a good abstract in my POV. If not using generics, we can only change the return type to interface{}, and use type conversion db.SelectOne(...).(StateMachineInstance) at the invocation.

Copy link
Contributor

@wt-better wt-better left a comment

Choose a reason for hiding this comment

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

There are some conflicts, please resolve.

ptyin added 2 commits February 2, 2024 12:06
@wt-better wt-better merged commit 33ff4e5 into apache:feature/saga Feb 22, 2024
1 check passed
@ptyin ptyin linked an issue Mar 11, 2024 that may be closed by this pull request
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.

Database persistence for seata-go Saga state machine
3 participants