Option (1): Savepoint and RollbackTo
Most SQL database systems do not really support nested transactions directly, but within a transaction implement Savepoint(name string) and RollbackTo(name string). This has the benefit of leaking fewer details of the underlying database.
Option (2): Nested Transaction
Paper over the database system and add "Tx.BeginTx(ctx context.Context, opts *TxOptions) (*Tx, error)". This would allow a seamless interface to be defined that is satisfied by either DB or Tx. I'm unsure of what the driver interface would look like.
Option (3): Do not provide an API for this. Use normal SQL if this is required.
-j
--
You received this message because you are subscribed to the Google Groups "golang-sql" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-sql+...@googlegroups.com.
To post to this group, send email to golan...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-sql/e2428ed6-b1c8-42e6-b733-b62e644088a2%40googlegroups.com.
> email to golang-sql+unsubscribe@googlegroups.com.
> To post to this group, send email to golan...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-sql/e2428ed6-b1c8-42e6-b733-b62e644088a2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-sql" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-sql+unsubscribe@googlegroups.com.
-j
-j