Documentation
¶
Index ¶
- Constants
- Variables
- type PostgresqlConnectionManager
- func (x *PostgresqlConnectionManager) GetDSN() string
- func (x *PostgresqlConnectionManager) Name() string
- func (x *PostgresqlConnectionManager) Return(ctx context.Context, connection *sql.DB) error
- func (x *PostgresqlConnectionManager) Shutdown(ctx context.Context) error
- func (x *PostgresqlConnectionManager) Take(ctx context.Context) (*sql.DB, error)
- type PostgresqlSqlProvider
- func (x *PostgresqlSqlProvider) CreateTableSql(ctx context.Context, tableFullName string) (string, []any)
- func (x *PostgresqlSqlProvider) CreateWithVersionSql(ctx context.Context, tableFullName string, lockId string, ...) (string, []any)
- func (x *PostgresqlSqlProvider) DeleteWithVersionSql(ctx context.Context, tableFullName string, lockId string, ...) (string, []any)
- func (x *PostgresqlSqlProvider) FindLockInformationJsonStringByIdSql(ctx context.Context, tableFullName string, lockId string) (string, []any)
- func (x *PostgresqlSqlProvider) ListLockInformationJsonStringSql(ctx context.Context, tableFullName string) (string, []any)
- func (x *PostgresqlSqlProvider) NowTimestampSql(ctx context.Context, tableFullName string) (string, []any)
- func (x *PostgresqlSqlProvider) SelectLockInformationJsonStringSql(ctx context.Context, tableFullName string, lockId string) (string, []any)
- func (x *PostgresqlSqlProvider) UpdateWithVersionSql(ctx context.Context, tableFullName string, lockId string, ...) (string, []any)
- type PostgresqlStorage
- func (x *PostgresqlStorage) CreateWithVersion(ctx context.Context, lockId string, version storage.Version, ...) (returnError error)
- func (x *PostgresqlStorage) GetName() string
- func (x *PostgresqlStorage) GetTime(ctx context.Context) (time.Time, error)
- func (x *PostgresqlStorage) Init(ctx context.Context) (returnError error)
- type PostgresqlStorageOptions
- func (x *PostgresqlStorageOptions) Check() error
- func (x *PostgresqlStorageOptions) GetSchema() string
- func (x *PostgresqlStorageOptions) GetTableFullName() string
- func (x *PostgresqlStorageOptions) GetTableName() string
- func (x *PostgresqlStorageOptions) SetConnectionManager(connectionManager storage.ConnectionManager[*sql.DB]) *PostgresqlStorageOptions
- func (x *PostgresqlStorageOptions) SetSchema(schema string) *PostgresqlStorageOptions
- func (x *PostgresqlStorageOptions) SetTableName(tableName string) *PostgresqlStorageOptions
Constants ¶
View Source
const DefaultPostgresqlStorageSchema = "public"
DefaultPostgresqlStorageSchema 默认的schema
View Source
const PostgresqlConnectionManagerName = "postgresql-connection-manager"
View Source
const PostgresqlStorageName = "postgresql-storage"
Variables ¶
View Source
var (
ErrQueryPostgresqlServerTime = errors.New("query postgresql server time failed")
)
Functions ¶
This section is empty.
Types ¶
type PostgresqlConnectionManager ¶ added in v0.0.2
type PostgresqlConnectionManager struct { // 主机的名字 Host string // 主机的端口 Port uint // 用户名 User string // 密码 Passwd string DatabaseName string // DSN // Example: "host=192.168.128.206 user=postgres password=123456 port=5432 dbname=postgres sslmode=disable" DSN string // contains filtered or unexported fields }
PostgresqlConnectionManager Postgresql的连接管理器
func NewPostgresqlConnectionGetterFromDsn ¶ added in v0.0.2
func NewPostgresqlConnectionGetterFromDsn(dsn string) *PostgresqlConnectionManager
NewPostgresqlConnectionGetterFromDsn 从DSN创建Postgresql连接
func NewPostgresqlConnectionGetterFromSqlDb ¶ added in v0.0.2
func NewPostgresqlConnectionGetterFromSqlDb(db *sql.DB) *PostgresqlConnectionManager
NewPostgresqlConnectionGetterFromSqlDb 从一个已经存在的*sql.DB创建连接管理器
func NewPostgresqlConnectionManager ¶ added in v0.0.2
func NewPostgresqlConnectionManager(host string, port uint, user, passwd, databaseName string) *PostgresqlConnectionManager
NewPostgresqlConnectionManager 从服务器属性创建数据库连接
func (*PostgresqlConnectionManager) GetDSN ¶ added in v0.0.2
func (x *PostgresqlConnectionManager) GetDSN() string
func (*PostgresqlConnectionManager) Name ¶ added in v0.0.2
func (x *PostgresqlConnectionManager) Name() string
type PostgresqlSqlProvider ¶ added in v0.0.2
type PostgresqlSqlProvider struct {
*sql_based_storage.Sql92Provider
}
PostgresqlSqlProvider storage sql的postgresql方言,因为使用的驱动的占位符不同,所以基本上每个语句都重写了,但处理占位符其它大差不差
func NewPostgresqlSqlProvider ¶ added in v0.0.2
func NewPostgresqlSqlProvider() *PostgresqlSqlProvider
func (*PostgresqlSqlProvider) CreateTableSql ¶ added in v0.0.2
func (*PostgresqlSqlProvider) CreateWithVersionSql ¶ added in v0.0.2
func (*PostgresqlSqlProvider) DeleteWithVersionSql ¶ added in v0.0.2
func (*PostgresqlSqlProvider) FindLockInformationJsonStringByIdSql ¶ added in v0.0.2
func (*PostgresqlSqlProvider) ListLockInformationJsonStringSql ¶ added in v0.0.2
func (*PostgresqlSqlProvider) NowTimestampSql ¶ added in v0.0.2
func (*PostgresqlSqlProvider) SelectLockInformationJsonStringSql ¶ added in v0.0.2
func (*PostgresqlSqlProvider) UpdateWithVersionSql ¶ added in v0.0.2
type PostgresqlStorage ¶ added in v0.0.2
type PostgresqlStorage struct { // postgresql是sql storage的一种具体实现 *sql_based_storage.SqlBasedStorage // contains filtered or unexported fields }
PostgresqlStorage 基于Postgresql作为存储引擎
func NewPostgresqlStorage ¶ added in v0.0.2
func NewPostgresqlStorage(ctx context.Context, options *PostgresqlStorageOptions) (*PostgresqlStorage, error)
func (*PostgresqlStorage) CreateWithVersion ¶ added in v0.0.2
func (x *PostgresqlStorage) CreateWithVersion(ctx context.Context, lockId string, version storage.Version, lockInformation *storage.LockInformation) (returnError error)
func (*PostgresqlStorage) GetName ¶ added in v0.0.2
func (x *PostgresqlStorage) GetName() string
type PostgresqlStorageOptions ¶ added in v0.0.2
type PostgresqlStorageOptions struct { // 存在哪个schema下,默认是public Schema string // 存放锁的表的名字,默认是storage_lock TableName string // 用于获取数据库连接 ConnectionManager storage.ConnectionManager[*sql.DB] }
PostgresqlStorageOptions 创建postgresql时的各种参数选项
func NewPostgresqlStorageOptions ¶ added in v0.0.2
func NewPostgresqlStorageOptions() *PostgresqlStorageOptions
NewPostgresqlStorageOptions 创建一个Storage选项
func (*PostgresqlStorageOptions) Check ¶ added in v0.0.2
func (x *PostgresqlStorageOptions) Check() error
func (*PostgresqlStorageOptions) GetSchema ¶ added in v0.0.2
func (x *PostgresqlStorageOptions) GetSchema() string
func (*PostgresqlStorageOptions) GetTableFullName ¶ added in v0.0.2
func (x *PostgresqlStorageOptions) GetTableFullName() string
func (*PostgresqlStorageOptions) GetTableName ¶ added in v0.0.2
func (x *PostgresqlStorageOptions) GetTableName() string
func (*PostgresqlStorageOptions) SetConnectionManager ¶ added in v0.0.2
func (x *PostgresqlStorageOptions) SetConnectionManager(connectionManager storage.ConnectionManager[*sql.DB]) *PostgresqlStorageOptions
func (*PostgresqlStorageOptions) SetSchema ¶ added in v0.0.2
func (x *PostgresqlStorageOptions) SetSchema(schema string) *PostgresqlStorageOptions
func (*PostgresqlStorageOptions) SetTableName ¶ added in v0.0.2
func (x *PostgresqlStorageOptions) SetTableName(tableName string) *PostgresqlStorageOptions
Source Files
¶
Click to show internal directories.
Click to hide internal directories.