func (driver *driver) AddGlobalSession(session *apis.GlobalSession) error {
	driver.SessionMap.Store(session.XID, &model.GlobalTransaction{
		GlobalSession:  session,
		BranchSessions: make(map[*apis.BranchSession]bool),
	})
	return nil
}
Add global session.
package inmemory
import (
	"fmt"
	"sync"
	"github.com/opentrx/seata-golang/v2/pkg/apis"
	"github.com/opentrx/seata-golang/v2/pkg/tc/model"
	"github.com/opentrx/seata-golang/v2/pkg/tc/storage"
	"github.com/opentrx/seata-golang/v2/pkg/tc/storage/driver/factory"
	"github.com/opentrx/seata-golang/v2/pkg/util/log"
)
func init() {
	factory.Register("inmemory", &inMemoryFactory{})
}
type inMemoryFactory struct{}
func (factory *inMemoryFactory) Create(parameters map[string]interface{}) (storage.Driver, error) {
	return &driver{
		SessionMap: &sync.Map{},
		LockMap:    &sync.Map{},
	}, nil
}
type driver struct {
	SessionMap *sync.Map
	LockMap *sync.Map
}