postgresql_storage

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MPL-2.0 Imports: 18 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLockFailed        = errors.New("lock failed")
	ErrUnlockFailed      = errors.New("unlock failed")
	ErrLockNotFound      = errors.New("lock not found")
	ErrLockNotBelongYou  = errors.New("lock not belong you")
	ErrLockRefreshFailed = errors.New("lock refresh failed")
)

Functions

func GetColumnPostgreSQLType added in v0.0.20

func GetColumnPostgreSQLType(table *schema.Table, column *schema.Column) (string, *schema.Diagnostics)

Convert Responsible for converting standard column types to their Postgresql counterparts

Types

type LockInformation added in v0.0.15

type LockInformation struct {

	// Who holds the lock
	OwnerId string

	// Reentrant lock
	LockCount int

	// The expected expiration time of this lock
	ExceptedExpireTime time.Time
}

LockInformation Some information about locks

func FromJsonString added in v0.0.15

func FromJsonString(jsonString string) (*LockInformation, error)

func (*LockInformation) ToJsonString added in v0.0.15

func (x *LockInformation) ToJsonString() string

type LockRefreshGoroutine added in v0.0.15

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

func NewLockRefreshGoroutine added in v0.0.15

func NewLockRefreshGoroutine(storage *PostgresqlStorage, lockId, ownerId string) *LockRefreshGoroutine

func (*LockRefreshGoroutine) Start added in v0.0.15

func (x *LockRefreshGoroutine) Start()

func (*LockRefreshGoroutine) Stop added in v0.0.15

func (x *LockRefreshGoroutine) Stop()

type PostgresqlCRUDExecutor

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

func NewPostgresqlCRUDExecutor

func NewPostgresqlCRUDExecutor(pool *pgxpool.Pool) *PostgresqlCRUDExecutor

func (*PostgresqlCRUDExecutor) Exec

func (x *PostgresqlCRUDExecutor) Exec(ctx context.Context, query string, args ...any) *schema.Diagnostics

func (*PostgresqlCRUDExecutor) Insert

func (*PostgresqlCRUDExecutor) Query

func (*PostgresqlCRUDExecutor) SetClientMeta

func (x *PostgresqlCRUDExecutor) SetClientMeta(clientMeta *schema.ClientMeta)

type PostgresqlKeyValueExecutor added in v0.0.13

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

func NewPostgresqlKeyValueExecutor added in v0.0.13

func NewPostgresqlKeyValueExecutor(executor *PostgresqlCRUDExecutor) *PostgresqlKeyValueExecutor

func (*PostgresqlKeyValueExecutor) DeleteKey added in v0.0.13

func (*PostgresqlKeyValueExecutor) GetValue added in v0.0.13

func (*PostgresqlKeyValueExecutor) ListKey added in v0.0.13

func (*PostgresqlKeyValueExecutor) SetKey added in v0.0.13

func (x *PostgresqlKeyValueExecutor) SetKey(ctx context.Context, key, value string) *schema.Diagnostics

type PostgresqlNamespaceAdmin

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

func NewPostgresqlNamespaceAdmin

func NewPostgresqlNamespaceAdmin(crudExecutor storage.CRUDExecutor) *PostgresqlNamespaceAdmin

func (*PostgresqlNamespaceAdmin) NamespaceCreate

func (x *PostgresqlNamespaceAdmin) NamespaceCreate(ctx context.Context, namespace string) *schema.Diagnostics

func (*PostgresqlNamespaceAdmin) NamespaceDrop

func (x *PostgresqlNamespaceAdmin) NamespaceDrop(ctx context.Context, namespace string) *schema.Diagnostics

func (*PostgresqlNamespaceAdmin) NamespaceList

func (x *PostgresqlNamespaceAdmin) NamespaceList(ctx context.Context) ([]string, *schema.Diagnostics)

type PostgresqlQueryResult

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

func (*PostgresqlQueryResult) Close

func (*PostgresqlQueryResult) Decode

func (x *PostgresqlQueryResult) Decode(item any) *schema.Diagnostics

func (*PostgresqlQueryResult) GetColumnNames

func (x *PostgresqlQueryResult) GetColumnNames() []string

func (*PostgresqlQueryResult) GetRawQueryResult

func (x *PostgresqlQueryResult) GetRawQueryResult() any

func (*PostgresqlQueryResult) Next

func (x *PostgresqlQueryResult) Next() bool

func (*PostgresqlQueryResult) ReadRows

func (x *PostgresqlQueryResult) ReadRows(rowLimit int) (*schema.Rows, *schema.Diagnostics)

func (*PostgresqlQueryResult) Values

func (x *PostgresqlQueryResult) Values() ([]any, *schema.Diagnostics)

func (*PostgresqlQueryResult) ValuesMap

func (x *PostgresqlQueryResult) ValuesMap() (map[string]any, *schema.Diagnostics)

type PostgresqlStorage

type PostgresqlStorage struct {
	*PostgresqlCRUDExecutor
	*PostgresqlTransactionExecutor
	*PostgresqlTableAdmin
	*PostgresqlNamespaceAdmin
	*PostgresqlKeyValueExecutor
	// contains filtered or unexported fields
}

func (*PostgresqlStorage) Close

func (x *PostgresqlStorage) Close() *schema.Diagnostics

func (*PostgresqlStorage) DebugF added in v0.0.17

func (x *PostgresqlStorage) DebugF(msg string, args ...any)

func (*PostgresqlStorage) ErrorF added in v0.0.17

func (x *PostgresqlStorage) ErrorF(msg string, args ...any)

func (*PostgresqlStorage) GetStorageConnection

func (x *PostgresqlStorage) GetStorageConnection() any

GetStorageConnection Expose THE CONNECTIONS OF THE PG SO THAT THE UPPER LAYER CAN DIRECTLY MANIPULATE THE CONNECTIONS OF THE LOWER layer if they feel it is necessary

func (*PostgresqlStorage) GetTime added in v0.0.20

func (x *PostgresqlStorage) GetTime(ctx context.Context) (time.Time, error)

func (*PostgresqlStorage) Lock added in v0.0.15

func (x *PostgresqlStorage) Lock(ctx context.Context, lockId, ownerId string) error

func (*PostgresqlStorage) NewColumnValueConvertor

func (x *PostgresqlStorage) NewColumnValueConvertor() schema.ColumnValueConvertor

func (*PostgresqlStorage) SetClientMeta

func (x *PostgresqlStorage) SetClientMeta(clientMeta *schema.ClientMeta)

func (*PostgresqlStorage) UnLock added in v0.0.15

func (x *PostgresqlStorage) UnLock(ctx context.Context, lockId, ownerId string) error

UnLock Release the lock, if it belongs to you

type PostgresqlStorageOptions

type PostgresqlStorageOptions struct {
	ConnectionString string
	SearchPath       string
}

func NewPostgresqlStorageOptions

func NewPostgresqlStorageOptions(connectionString string) *PostgresqlStorageOptions

func (*PostgresqlStorageOptions) FromJsonString

func (x *PostgresqlStorageOptions) FromJsonString(jsonString string) error

func (*PostgresqlStorageOptions) ToJsonString

func (x *PostgresqlStorageOptions) ToJsonString() (string, error)

type PostgresqlTableAdmin

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

func NewPostgresqlTableAdmin

func NewPostgresqlTableAdmin(crudExecutor storage.CRUDExecutor) *PostgresqlTableAdmin

func (*PostgresqlTableAdmin) TableCreate

func (x *PostgresqlTableAdmin) TableCreate(ctx context.Context, table *schema.Table) *schema.Diagnostics

func (*PostgresqlTableAdmin) TableDrop

func (x *PostgresqlTableAdmin) TableDrop(ctx context.Context, table *schema.Table) *schema.Diagnostics

func (*PostgresqlTableAdmin) TableList

func (x *PostgresqlTableAdmin) TableList(ctx context.Context, namespace string) ([]*schema.Table, *schema.Diagnostics)

TableList List all the tables under PG, here considering that the table may be very many, so the enumeration is concurrent

func (*PostgresqlTableAdmin) TablesCreate

func (x *PostgresqlTableAdmin) TablesCreate(ctx context.Context, tables []*schema.Table) *schema.Diagnostics

func (*PostgresqlTableAdmin) TablesDrop

func (x *PostgresqlTableAdmin) TablesDrop(ctx context.Context, tables []*schema.Table) *schema.Diagnostics

type PostgresqlTransactionExecutor

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

func NewPostgresqlTransactionExecutor

func NewPostgresqlTransactionExecutor(pool *pgxpool.Pool) *PostgresqlTransactionExecutor

func (*PostgresqlTransactionExecutor) Begin

func (*PostgresqlTransactionExecutor) Commit

func (*PostgresqlTransactionExecutor) Rollback

Jump to

Keyboard shortcuts

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