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

Generalise Transactor to use with no sеdlib libraries #26

Closed
kozmod opened this issue Aug 5, 2023 · 0 comments · Fixed by #27
Closed

Generalise Transactor to use with no sеdlib libraries #26

kozmod opened this issue Aug 5, 2023 · 0 comments · Fixed by #27
Labels
enhancement New feature or request

Comments

@kozmod
Copy link
Owner

kozmod commented Aug 5, 2023

Need to generalise the Transactor for using with different libs witch supported transactions (pix, sqlx, etc.).
It will be make using generic approach

type (
	TxBeginner[C TxCommitter, O any] interface {
		comparable
		BeginTx(ctx context.Context, opts ...Option[O]) (C, error)
	}

	TxCommitter interface {
		Rollback(ctx context.Context) error
		Commit(ctx context.Context) error
	}

	Option[TxOpt any] interface {
		Apply(in TxOpt)
	}

	СtxOperator[C TxCommitter] interface {
		Inject(ctx context.Context, c C) context.Context
		Extract(ctx context.Context) (C, bool)
	}
)
type Transactor[B TxBeginner[C, O], C TxCommitter, O any] struct {
	beginner B
	operator СtxOperator[C]
}

, or by another way.

kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
@kozmod kozmod added the enhancement New feature or request label Aug 5, 2023
@kozmod kozmod linked a pull request Aug 5, 2023 that will close this issue
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
[#26] generalising `Transactor` with generics
@kozmod kozmod closed this as completed Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
kozmod added a commit that referenced this issue Aug 5, 2023
@kozmod kozmod changed the title Generalise Transactor to use with no sodlib libraries Generalise Transactor to use with no sеdlib libraries Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant