Documentation ¶
Index ¶
- Constants
- type SqlServerStorage
- func (x *SqlServerStorage) Close(ctx context.Context) error
- func (x *SqlServerStorage) DeleteWithVersion(ctx context.Context, lockId string, exceptedVersion storage.Version, ...) error
- func (x *SqlServerStorage) Get(ctx context.Context, lockId string) (string, error)
- func (x *SqlServerStorage) GetName() string
- func (x *SqlServerStorage) GetTime(ctx context.Context) (time.Time, error)
- func (x *SqlServerStorage) Init(ctx context.Context) error
- func (x *SqlServerStorage) InsertWithVersion(ctx context.Context, lockId string, version storage.Version, ...) error
- func (x *SqlServerStorage) List(ctx context.Context) (iterator.Iterator[*storage.LockInformation], error)
- func (x *SqlServerStorage) UpdateWithVersion(ctx context.Context, lockId string, ...) error
- type SqlServerStorageConnectionManager
- func (x *SqlServerStorageConnectionManager) GetDSN() string
- func (x *SqlServerStorageConnectionManager) Name() string
- func (x *SqlServerStorageConnectionManager) Return(ctx context.Context, db *sql.DB) error
- func (x *SqlServerStorageConnectionManager) Shutdown(ctx context.Context) error
- func (x *SqlServerStorageConnectionManager) Take(ctx context.Context) (*sql.DB, error)
- type SqlServerStorageOptions
Constants ¶
View Source
const StorageName = "sql-server-storage"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SqlServerStorage ¶
type SqlServerStorage struct {
// contains filtered or unexported fields
}
func NewSqlServerStorage ¶
func NewSqlServerStorage(ctx context.Context, options *SqlServerStorageOptions) (*SqlServerStorage, error)
func (*SqlServerStorage) DeleteWithVersion ¶
func (x *SqlServerStorage) DeleteWithVersion(ctx context.Context, lockId string, exceptedVersion storage.Version, lockInformation *storage.LockInformation) error
func (*SqlServerStorage) GetName ¶
func (x *SqlServerStorage) GetName() string
func (*SqlServerStorage) InsertWithVersion ¶
func (x *SqlServerStorage) InsertWithVersion(ctx context.Context, lockId string, version storage.Version, lockInformation *storage.LockInformation) error
func (*SqlServerStorage) List ¶
func (x *SqlServerStorage) List(ctx context.Context) (iterator.Iterator[*storage.LockInformation], error)
func (*SqlServerStorage) UpdateWithVersion ¶
func (x *SqlServerStorage) UpdateWithVersion(ctx context.Context, lockId string, exceptedVersion, newVersion storage.Version, lockInformation *storage.LockInformation) error
type SqlServerStorageConnectionManager ¶
type SqlServerStorageConnectionManager struct { // 主机的名字 Host string // 主机的端口 Port uint // 用户名 User string // 密码 Passwd string // DSN // Example: "sqlserver://sa:UeGqAm8CxYGldMDLoNNt@192.168.128.206:1433" DSN string // contains filtered or unexported fields }
SqlServerStorageConnectionManager 创建一个SqlServer的连接
func NewSqlServerStorageConnectionGetter ¶
func NewSqlServerStorageConnectionGetter(host string, port uint, user, passwd string) *SqlServerStorageConnectionManager
NewSqlServerStorageConnectionGetter 从服务器属性创建数据库连接
func NewSqlServerStorageConnectionGetterFromDSN ¶
func NewSqlServerStorageConnectionGetterFromDSN(dsn string) *SqlServerStorageConnectionManager
NewSqlServerStorageConnectionGetterFromDSN 从DSN创建SqlServer连接
func (*SqlServerStorageConnectionManager) GetDSN ¶
func (x *SqlServerStorageConnectionManager) GetDSN() string
func (*SqlServerStorageConnectionManager) Name ¶
func (x *SqlServerStorageConnectionManager) Name() string
type SqlServerStorageOptions ¶
type SqlServerStorageOptions struct { // 存放锁的表的名字 TableName string // 用于获取数据库连接 ConnectionManager storage.ConnectionManager[*sql.DB] }
func NewSqlServerStorageOptions ¶
func NewSqlServerStorageOptions() *SqlServerStorageOptions
func (*SqlServerStorageOptions) SetConnectionManage ¶
func (x *SqlServerStorageOptions) SetConnectionManage(connectionManager storage.ConnectionManager[*sql.DB]) *SqlServerStorageOptions
func (*SqlServerStorageOptions) SetTableName ¶
func (x *SqlServerStorageOptions) SetTableName(tableName string) *SqlServerStorageOptions
Click to show internal directories.
Click to hide internal directories.