Documentation ¶
Index ¶
- func BuildPgIdentityColumnResetCurrentSql(schema, table, column string) string
- func BuildPgInsertIdentityAlwaysSql(insertQuery string) string
- func BuildPgResetSequenceSql(sequenceName string) string
- func BuildPgTruncateCascadeStatement(schema string, table string) (string, error)
- func BuildPgTruncateStatement(tables []*sqlmanager_shared.SchemaTable) (string, error)
- func EscapePgColumn(col string) string
- func EscapePgColumns(cols []string) []string
- func GetPostgresColumnOverrideAndResetProperties(columnInfo *sqlmanager_shared.ColumnInfo) (needsOverride, needsReset bool)
- 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) GetRolePermissionsMap(ctx context.Context) (map[string][]string, error)
- func (p *PostgresManager) GetSchemaColumnMap(ctx context.Context) (map[string]map[string]*sqlmanager_shared.ColumnInfo, error)
- func (p *PostgresManager) GetSchemaInitStatements(ctx context.Context, tables []*sqlmanager_shared.SchemaTable) ([]*sqlmanager_shared.InitSchemaStatements, 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) GetSequencesByTables(ctx context.Context, schema string, tables []string) ([]*sqlmanager_shared.DataType, 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)
- type SequenceConfiguration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPgIdentityColumnResetCurrentSql ¶ added in v0.4.66
func BuildPgInsertIdentityAlwaysSql ¶ added in v0.4.67
func BuildPgResetSequenceSql ¶ added in v0.4.73
func BuildPgTruncateStatement ¶
func BuildPgTruncateStatement( tables []*sqlmanager_shared.SchemaTable, ) (string, error)
func EscapePgColumn ¶
func EscapePgColumns ¶
func GetPostgresColumnOverrideAndResetProperties ¶ added in v0.4.70
func GetPostgresColumnOverrideAndResetProperties(columnInfo *sqlmanager_shared.ColumnInfo) (needsOverride, needsReset bool)
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) 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) GetSchemaInitStatements ¶ added in v0.4.30
func (p *PostgresManager) GetSchemaInitStatements( ctx context.Context, tables []*sqlmanager_shared.SchemaTable, ) ([]*sqlmanager_shared.InitSchemaStatements, error)
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) GetSequencesByTables ¶ added in v0.4.73
func (p *PostgresManager) GetSequencesByTables(ctx context.Context, schema string, tables []string) ([]*sqlmanager_shared.DataType, 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 ¶
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
Click to show internal directories.
Click to hide internal directories.