gorm_locks

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Gorm Locks

基于GORM做分布式锁。

go get -u github.com/storage-lock/go-gorm-locks 

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateStorageForGormDb

func CreateStorageForGormDb(db *gorm.DB, connectionManager storage.ConnectionManager[*sql.DB]) (storage.Storage, error)

CreateStorageForGormDb 尝试从GORM创建Storage

func InitGormLockFactory

func InitGormLockFactory(db *gorm.DB) error

Types

type GormConnectionManager

type GormConnectionManager struct {
	// contains filtered or unexported fields
}

GormConnectionManager 从Gorm(https://github.com/go-gorm/gorm)获取数据库连接,如果当前项目是引入的gorm的话则可以与其复用数据库连接资源 TODO 2023-8-4 01:34:49 单元测试

func NewGormConnectionManager

func NewGormConnectionManager(db *gorm.DB) *GormConnectionManager

func (*GormConnectionManager) Name

func (x *GormConnectionManager) Name() string

func (*GormConnectionManager) Return

func (x *GormConnectionManager) Return(ctx context.Context, db *sql.DB) error

func (*GormConnectionManager) Shutdown

func (x *GormConnectionManager) Shutdown(ctx context.Context) error

func (*GormConnectionManager) Take

func (x *GormConnectionManager) Take(ctx context.Context) (*sql.DB, error)

type GormLockFactory

type GormLockFactory struct {
	*storage_lock_factory.StorageLockFactory[*sql.DB]
	// contains filtered or unexported fields
}
var GlobalGormLockFactory *GormLockFactory

func NewGormLockFactory

func NewGormLockFactory(db *gorm.DB) (*GormLockFactory, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址