Documentation
¶
Overview ¶
MIT License
Copyright (c) 2025 OcomSoft ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- type Provider
- func (p *Provider) ConvertFieldType(field *types.Field) string
- func (p *Provider) GenerateAddColumn(tableName string, field *types.Field) string
- func (p *Provider) GenerateAlterColumn(tableName string, oldField, newField *types.Field) (string, error)
- func (p *Provider) GenerateCreateIndex(index *types.Index, tableName string) string
- func (p *Provider) GenerateCreateTable(schema *types.Schema, table *types.Table) (string, error)
- func (p *Provider) GenerateDropColumn(tableName, columnName string) string
- func (p *Provider) GenerateDropForeignKeyConstraint(tableName, constraintName string) string
- func (p *Provider) GenerateDropIndex(indexName, tableName string) string
- func (p *Provider) GenerateDropTable(tableName string) string
- func (p *Provider) GenerateDropTableCascade(tableName string) string
- func (p *Provider) GenerateForeignKeyConstraint(...) string
- func (p *Provider) GenerateForeignKeyConstraints(schema *types.Schema, junctionTables []types.Table) string
- func (p *Provider) GenerateIndexes(schema *types.Schema) string
- func (p *Provider) GenerateJunctionTable(table1, table2 string, schema *types.Schema) (string, error)
- func (p *Provider) GenerateRenameColumn(tableName, oldName, newName string) string
- func (p *Provider) GenerateRenameTable(oldName, newName string) string
- func (p *Provider) GenerateUpsert(table string, conflictKeys []string, columns []string, ...) string
- func (p *Provider) GetDatabaseSchema(connectionString string) (*types.Schema, error)
- func (p *Provider) GetDefaultValue(defaultRef string, defaults map[string]string) (string, error)
- func (p *Provider) HistoryTableDDL() string
- func (p *Provider) InferForeignKeyType(referencedTable string, schema *types.Schema) string
- func (p *Provider) IsAlreadyExistsError(err error) bool
- func (p *Provider) IsNotFoundError(err error) bool
- func (p *Provider) Placeholder(n int) string
- func (p *Provider) QuoteName(name string) string
- func (p *Provider) SetTypeMappings(mappings map[string]string)
- func (p *Provider) SupportsOperation(operation string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the Provider interface for Amazon Redshift Redshift is based on PostgreSQL but has some differences
func (*Provider) ConvertFieldType ¶
ConvertFieldType converts YAML field type to Redshift-specific SQL type
func (*Provider) GenerateAddColumn ¶
GenerateAddColumn generates ALTER TABLE ADD COLUMN statement. The DEFAULT clause is emitted when field.Default is non-empty (already resolved from symbolic keys by resolveFieldDefault before this is called).
func (*Provider) GenerateAlterColumn ¶
func (*Provider) GenerateCreateIndex ¶
GenerateCreateIndex generates CREATE INDEX statement for Redshift
func (*Provider) GenerateCreateTable ¶
GenerateCreateTable generates CREATE TABLE statement for Redshift
func (*Provider) GenerateDropColumn ¶
GenerateDropColumn generates ALTER TABLE DROP COLUMN statement
func (*Provider) GenerateDropForeignKeyConstraint ¶
func (*Provider) GenerateDropIndex ¶
GenerateDropIndex generates DROP INDEX statement for Redshift
func (*Provider) GenerateDropTable ¶
GenerateDropTable generates DROP TABLE statement
func (*Provider) GenerateDropTableCascade ¶
GenerateDropTableCascade generates a DROP TABLE statement for Redshift. Redshift does not support CASCADE on DROP TABLE in the same manner as PostgreSQL, so this is an alias for GenerateDropTable.
func (*Provider) GenerateForeignKeyConstraint ¶
func (*Provider) GenerateForeignKeyConstraints ¶
func (*Provider) GenerateJunctionTable ¶
func (*Provider) GenerateRenameColumn ¶
GenerateRenameColumn generates ALTER TABLE RENAME COLUMN statement Redshift doesn't support RENAME COLUMN directly, would need to use ADD/DROP pattern
func (*Provider) GenerateRenameTable ¶
GenerateRenameTable generates ALTER TABLE RENAME statement
func (*Provider) GenerateUpsert ¶
func (p *Provider) GenerateUpsert(table string, conflictKeys []string, columns []string, valueLiterals [][]string) string
GenerateUpsert generates a DELETE-then-INSERT pattern for Redshift, since Redshift does not support ON CONFLICT or MERGE. If no conflictKeys are provided, only the INSERT is generated. The valueLiterals are pre-formatted SQL literals and are not re-quoted.
func (*Provider) GetDatabaseSchema ¶
GetDatabaseSchema extracts schema information from a Redshift database
func (*Provider) GetDefaultValue ¶
GetDefaultValue converts default value references to Redshift-specific values
func (*Provider) HistoryTableDDL ¶
HistoryTableDDL returns the CREATE TABLE IF NOT EXISTS statement for the morphic_history migration-tracking table, using this provider's SQL dialect.
func (*Provider) InferForeignKeyType ¶
func (*Provider) IsAlreadyExistsError ¶
IsAlreadyExistsError returns true when err indicates an object already exists in the database.
func (*Provider) IsNotFoundError ¶
IsNotFoundError returns true when err is a Redshift "does not exist" error.
func (*Provider) Placeholder ¶
Placeholder returns the bind-parameter placeholder for the nth argument (1-indexed).
func (*Provider) QuoteName ¶
QuoteName quotes database identifiers for Redshift (same as PostgreSQL)
func (*Provider) SetTypeMappings ¶
SetTypeMappings sets user-defined type mappings for this provider.
func (*Provider) SupportsOperation ¶
SupportsOperation checks if Redshift supports a specific operation