Documentation ¶
Index ¶
- func BuildPgTruncateCascadeStatement(schema string, table string) (string, error)
- func BuildPgTruncateStatement(tables []string) string
- func EscapePgColumn(col string) string
- func EscapePgColumns(cols []string) []string
- type PostgresManager
- func (p *PostgresManager) BatchExec(ctx context.Context, batchSize int, statements []string, ...) error
- func (p *PostgresManager) Close()
- func (p *PostgresManager) Exec(ctx context.Context, statement string) error
- func (p *PostgresManager) GetCreateTableStatement(ctx context.Context, schema, table string) (string, error)
- func (p *PostgresManager) GetDatabaseSchema(ctx context.Context) ([]*sqlmanager_shared.DatabaseSchemaRow, error)
- func (p *PostgresManager) GetForeignKeyConstraints(ctx context.Context, schemas []string) ([]*sqlmanager_shared.ForeignKeyConstraintsRow, error)
- func (p *PostgresManager) GetForeignKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]*sqlmanager_shared.ForeignConstraint, error)
- func (p *PostgresManager) GetPrimaryKeyConstraints(ctx context.Context, schemas []string) ([]*sqlmanager_shared.PrimaryKey, error)
- func (p *PostgresManager) GetPrimaryKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]string, error)
- func (p *PostgresManager) GetRolePermissionsMap(ctx context.Context, role string) (map[string][]string, error)
- func (p *PostgresManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.ColumnInfo, error)
- func (p *PostgresManager) GetSchemaTableDataTypes(ctx context.Context, tables []*sqlmanager_shared.SchemaTable) (*sqlmanager_shared.SchemaTableDataTypeResponse, error)
- func (p *PostgresManager) GetSchemaTableTriggers(ctx context.Context, tables []*sqlmanager_shared.SchemaTable) ([]*sqlmanager_shared.TableTrigger, error)
- func (p *PostgresManager) GetTableConstraintsBySchema(ctx context.Context, schemas []string) (*sqlmanager_shared.TableConstraints, error)
- func (p *PostgresManager) GetTableInitStatements(ctx context.Context, tables []*sqlmanager_shared.SchemaTable) ([]*sqlmanager_shared.TableInitStatement, error)
- func (p *PostgresManager) GetTableRowCount(ctx context.Context, schema, table string, whereClause *string) (int64, error)
- func (p *PostgresManager) GetUniqueConstraintsMap(ctx context.Context, schemas []string) (map[string][][]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EscapePgColumn ¶
func EscapePgColumns ¶
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 (*PostgresManager) GetDatabaseSchema ¶
func (p *PostgresManager) GetDatabaseSchema(ctx context.Context) ([]*sqlmanager_shared.DatabaseSchemaRow, error)
func (*PostgresManager) GetForeignKeyConstraints ¶
func (p *PostgresManager) GetForeignKeyConstraints(ctx context.Context, schemas []string) ([]*sqlmanager_shared.ForeignKeyConstraintsRow, error)
func (*PostgresManager) GetForeignKeyConstraintsMap ¶
func (p *PostgresManager) GetForeignKeyConstraintsMap(ctx context.Context, schemas []string) (map[string][]*sqlmanager_shared.ForeignConstraint, error)
Key is schema.table value is list of tables that key depends on
func (*PostgresManager) GetPrimaryKeyConstraints ¶
func (p *PostgresManager) GetPrimaryKeyConstraints(ctx context.Context, schemas []string) ([]*sqlmanager_shared.PrimaryKey, error)
func (*PostgresManager) GetPrimaryKeyConstraintsMap ¶
func (*PostgresManager) GetRolePermissionsMap ¶
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) GetSchemaTableDataTypes ¶
func (p *PostgresManager) GetSchemaTableDataTypes(ctx context.Context, tables []*sqlmanager_shared.SchemaTable) (*sqlmanager_shared.SchemaTableDataTypeResponse, error)
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 (p *PostgresManager) GetTableInitStatements(ctx context.Context, tables []*sqlmanager_shared.SchemaTable) ([]*sqlmanager_shared.TableInitStatement, error)
func (*PostgresManager) GetTableRowCount ¶
func (*PostgresManager) GetUniqueConstraintsMap ¶
Click to show internal directories.
Click to hide internal directories.