func (tx *Tx) Commit() error {
	txDriver := tx.config.driver.(*txDriver)
	var fn Committer = CommitFunc(func(context.Context, *Tx) error {
		return txDriver.tx.Commit()
	})
	tx.mu.Lock()
	hooks := append([]CommitHook(nil), tx.onCommit...)
	tx.mu.Unlock()
	for i := len(hooks) - 1; i >= 0; i-- {
		fn = hooks[i](fn)
	}
	return fn.Commit(tx.ctx, tx)
}
Commit commits the transaction.
package ent
import (
	"context"
	"sync"
	"entgo.io/ent/dialect"
)
type Tx struct {
	config
	Category *CategoryClient
	Todo *TodoClient
	VerySecret *VerySecretClient
	client     *Client
	clientOnce sync.Once
	mu         sync.Mutex
	onCommit   []CommitHook
	onRollback []RollbackHook
	ctx context.Context
}
type (
	Committer interface {
		Commit(context.Context, *Tx) error
	}
	CommitFunc func(context.Context, *Tx) error
	CommitHook func(Committer) Committer
)
func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error {
	return f(ctx, tx)
}