sqlmanager_postgres

package
v0.4.59 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPgTruncateCascadeStatement

func BuildPgTruncateCascadeStatement(
	schema string,
	table string,
) (string, error)

func BuildPgTruncateStatement

func BuildPgTruncateStatement(
	tables []string,
) string

func EscapePgColumn

func EscapePgColumn(col string) string

func EscapePgColumns

func EscapePgColumns(cols []string) []string

Types

type PostgresManager

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

func NewManager

func NewManager(querier pg_queries.Querier, pool pg_queries.DBTX, closer func()) *PostgresManager

func (*PostgresManager) BatchExec

func (p *PostgresManager) BatchExec(ctx context.Context, batchSize int, statements []string, opts *sqlmanager_shared.BatchExecOpts) error

func (*PostgresManager) Close

func (p *PostgresManager) Close()

func (*PostgresManager) Exec

func (p *PostgresManager) Exec(ctx context.Context, statement string) error

func (*PostgresManager) GetCreateTableStatement

func (p *PostgresManager) GetCreateTableStatement(ctx context.Context, schema, table string) (string, error)

func (*PostgresManager) GetDatabaseSchema

func (p *PostgresManager) GetDatabaseSchema(ctx context.Context) ([]*sqlmanager_shared.DatabaseSchemaRow, error)

func (*PostgresManager) GetRolePermissionsMap

func (p *PostgresManager) GetRolePermissionsMap(ctx context.Context) (map[string][]string, error)

func (*PostgresManager) GetSchemaColumnMap

func (p *PostgresManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.ColumnInfo, error)

returns: {public.users: { id: struct{}{}, created_at: struct{}{}}}

func (*PostgresManager) GetSchemaInitStatements added in v0.4.30

func (p *PostgresManager) GetSchemaInitStatements(
	ctx context.Context,
	tables []*sqlmanager_shared.SchemaTable,
) ([]*sqlmanager_shared.InitSchemaStatements, error)

func (*PostgresManager) GetSchemaTableDataTypes

Returns ansilary dependencies like sequences, datatypes, functions, etc that are used by tables, but live at the schema level

func (*PostgresManager) GetSchemaTableTriggers

func (p *PostgresManager) GetSchemaTableTriggers(ctx context.Context, tables []*sqlmanager_shared.SchemaTable) ([]*sqlmanager_shared.TableTrigger, error)

func (*PostgresManager) GetTableConstraintsBySchema

func (p *PostgresManager) GetTableConstraintsBySchema(ctx context.Context, schemas []string) (*sqlmanager_shared.TableConstraints, error)

func (*PostgresManager) GetTableInitStatements

func (*PostgresManager) GetTableRowCount

func (p *PostgresManager) GetTableRowCount(
	ctx context.Context,
	schema, table string,
	whereClause *string,
) (int64, error)

type SequenceConfiguration added in v0.4.35

type SequenceConfiguration struct {
	IncrementBy int64
	MinValue    int64
	MaxValue    int64
	StartValue  int64
	CacheValue  int64
	CycleOption bool
}

func (*SequenceConfiguration) ToGeneratedAlwaysIdentity added in v0.4.35

func (s *SequenceConfiguration) ToGeneratedAlwaysIdentity() string

func (*SequenceConfiguration) ToGeneratedDefaultIdentity added in v0.4.35

func (s *SequenceConfiguration) ToGeneratedDefaultIdentity() string

Jump to

Keyboard shortcuts

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