Documentation
¶
Index ¶
- Constants
- type MySQLConnectionManager
- func (x *MySQLConnectionManager) GetDSN() string
- func (x *MySQLConnectionManager) Name() string
- func (x *MySQLConnectionManager) Return(ctx context.Context, db *sql.DB) error
- func (x *MySQLConnectionManager) SetDatabaseName(databaseName string) *MySQLConnectionManager
- func (x *MySQLConnectionManager) SetHost(host string) *MySQLConnectionManager
- func (x *MySQLConnectionManager) SetPasswd(passwd string) *MySQLConnectionManager
- func (x *MySQLConnectionManager) SetPort(port uint) *MySQLConnectionManager
- func (x *MySQLConnectionManager) SetUser(user string) *MySQLConnectionManager
- func (x *MySQLConnectionManager) Shutdown(ctx context.Context) error
- func (x *MySQLConnectionManager) Take(ctx context.Context) (*sql.DB, error)
- type MySQLStorage
- func (x *MySQLStorage) Close(ctx context.Context) error
- func (x *MySQLStorage) CreateWithVersion(ctx context.Context, lockId string, version storage.Version, ...) (returnError error)
- func (x *MySQLStorage) DeleteWithVersion(ctx context.Context, lockId string, exceptedVersion storage.Version, ...) (returnError error)
- func (x *MySQLStorage) Get(ctx context.Context, lockId string) (lockInformationJsonString string, returnError error)
- func (x *MySQLStorage) GetName() string
- func (x *MySQLStorage) GetTime(ctx context.Context) (now time.Time, returnError error)
- func (x *MySQLStorage) Init(ctx context.Context) (returnError error)
- func (x *MySQLStorage) List(ctx context.Context) (iterator iterator.Iterator[*storage.LockInformation], returnError error)
- func (x *MySQLStorage) UpdateWithVersion(ctx context.Context, lockId string, ...) (returnError error)
- type MySQLStorageOptions
Constants ¶
View Source
const MySQLConnectionManagerName = "mysql-connection-manager"
View Source
const StorageName = "mysql-storage"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MySQLConnectionManager ¶
type MySQLConnectionManager struct { // 主机的名字 Host string // 主机的端口 Port uint // 用户名 User string // 密码 Passwd string DatabaseName string DSN string // contains filtered or unexported fields }
MySQLConnectionManager 创建一个MySQL的连接管理器
func NewMySQLConnectionManager ¶ added in v0.0.2
func NewMySQLConnectionManager(host string, port uint, user, passwd, database string) *MySQLConnectionManager
NewMySQLConnectionManager 从连接属性创建数据库连接
func NewMySQLConnectionManagerFromDSN ¶
func NewMySQLConnectionManagerFromDSN(dsn string) *MySQLConnectionManager
NewMySQLConnectionManagerFromDSN 从DSN创建MySQL连接管理器
func (*MySQLConnectionManager) GetDSN ¶
func (x *MySQLConnectionManager) GetDSN() string
func (*MySQLConnectionManager) Name ¶
func (x *MySQLConnectionManager) Name() string
func (*MySQLConnectionManager) SetDatabaseName ¶
func (x *MySQLConnectionManager) SetDatabaseName(databaseName string) *MySQLConnectionManager
func (*MySQLConnectionManager) SetHost ¶
func (x *MySQLConnectionManager) SetHost(host string) *MySQLConnectionManager
func (*MySQLConnectionManager) SetPasswd ¶
func (x *MySQLConnectionManager) SetPasswd(passwd string) *MySQLConnectionManager
func (*MySQLConnectionManager) SetPort ¶
func (x *MySQLConnectionManager) SetPort(port uint) *MySQLConnectionManager
func (*MySQLConnectionManager) SetUser ¶
func (x *MySQLConnectionManager) SetUser(user string) *MySQLConnectionManager
type MySQLStorage ¶
type MySQLStorage struct {
// contains filtered or unexported fields
}
func NewMySQLStorage ¶
func NewMySQLStorage(ctx context.Context, options *MySQLStorageOptions) (*MySQLStorage, error)
func (*MySQLStorage) CreateWithVersion ¶ added in v0.0.2
func (x *MySQLStorage) CreateWithVersion(ctx context.Context, lockId string, version storage.Version, lockInformation *storage.LockInformation) (returnError error)
func (*MySQLStorage) DeleteWithVersion ¶
func (x *MySQLStorage) DeleteWithVersion(ctx context.Context, lockId string, exceptedVersion storage.Version, lockInformation *storage.LockInformation) (returnError error)
func (*MySQLStorage) GetName ¶
func (x *MySQLStorage) GetName() string
func (*MySQLStorage) List ¶
func (x *MySQLStorage) List(ctx context.Context) (iterator iterator.Iterator[*storage.LockInformation], returnError error)
func (*MySQLStorage) UpdateWithVersion ¶
func (x *MySQLStorage) UpdateWithVersion(ctx context.Context, lockId string, exceptedVersion, newVersion storage.Version, lockInformation *storage.LockInformation) (returnError error)
type MySQLStorageOptions ¶
type MySQLStorageOptions struct { // 存放锁的表的名字,如果未指定的话则使用默认的表 TableName string // 用于获取数据库连接 ConnectionManager storage.ConnectionManager[*sql.DB] }
MySQLStorageOptions 基于MySQL为存储引擎时的选项
func NewMySQLStorageOptions ¶
func NewMySQLStorageOptions() *MySQLStorageOptions
func (*MySQLStorageOptions) SetConnectionManager ¶ added in v0.0.2
func (x *MySQLStorageOptions) SetConnectionManager(connManager storage.ConnectionManager[*sql.DB]) *MySQLStorageOptions
func (*MySQLStorageOptions) SetTableName ¶
func (x *MySQLStorageOptions) SetTableName(tableName string) *MySQLStorageOptions
Source Files
¶
Click to show internal directories.
Click to hide internal directories.