Documentation
¶
Index ¶
- Constants
- Variables
- func AttachIndexAndAction(allTable []objects.Table, allIndex []objects.Index, ...) []objects.Table
- func BuildGenerateModelInputs(tables []objects.Table, policies objects.Policies, ...) []*generator.GenerateModelInput
- func Compare(mode CompareMode, source []objects.Table, target []objects.Table) error
- func GenerateDiffChangeMessage(newTable []string, updateTable []string, deleteTable []string) (string, error)
- func GenerateDiffChangeUpdateMessage(name string, item MigrateItem) (string, error)
- func GenerateDiffMessage(diffData CompareDiffResult, sRelation MapRelations, tRelation MapRelations) (string, error)
- func GetDiffChangeMessage(items []MigrateItem) string
- func GetNewCountData(supabaseData []objects.Table, localData state.ExtractTableResult) int
- func Migrate(config *raiden.Config, tables []MigrateItem, stateChan chan any, ...) []error
- func PrintDiff(diffData CompareDiffResult, sRelation MapRelations, tRelation MapRelations)
- func PrintDiffResult(diffResult []CompareDiffResult, sRelation MapRelations, tRelation MapRelations) error
- type CompareDiffResult
- type CompareMode
- type ManyToManyTable
- type MapRelations
- type MapTable
- type MigrateActionFunc
- type MigrateItem
Constants ¶
View Source
const DiffChangeTemplate = `` /* 330-byte string literal not displayed */
View Source
const DiffChangeUpdateTemplate = `` /* 441-byte string literal not displayed */
View Source
const DiffTemplate = `
{{- .Columns}}
{{- .Metadata}}
{{- .Acl}}
{{- .Relations}}
`
----- generate message section ------
Variables ¶
View Source
var ActionFunc = MigrateActionFunc{ CreateFunc: func(cfg *raiden.Config, param objects.Table) (response objects.Table, err error) { if cfg.Mode == raiden.SvcMode { return pgmeta.CreateTable(cfg, param) } return supabase.CreateTable(cfg, param) }, UpdateFunc: func(cfg *raiden.Config, param objects.Table, items objects.UpdateTableParam) (err error) { if cfg.Mode == raiden.SvcMode { return pgmeta.UpdateTable(cfg, param, items) } return supabase.UpdateTable(cfg, param, items) }, DeleteFunc: func(cfg *raiden.Config, param objects.Table) (err error) { if cfg.Mode == raiden.SvcMode { return pgmeta.DeleteTable(cfg, param, true) } return supabase.DeleteTable(cfg, param, true) }, }
View Source
var Logger hclog.Logger = logger.HcLog().Named("resource.tables")
Functions ¶
func AttachIndexAndAction ¶ added in v1.0.0
func AttachIndexAndAction(allTable []objects.Table, allIndex []objects.Index, allAction []objects.TablesRelationshipAction) []objects.Table
--- attach index and action to relation
func BuildGenerateModelInputs ¶
func BuildGenerateModelInputs(tables []objects.Table, policies objects.Policies, mapModelValidationTags map[string]state.ModelValidationTag) []*generator.GenerateModelInput
func GenerateDiffChangeUpdateMessage ¶
func GenerateDiffChangeUpdateMessage(name string, item MigrateItem) (string, error)
func GenerateDiffMessage ¶
func GenerateDiffMessage(diffData CompareDiffResult, sRelation MapRelations, tRelation MapRelations) (string, error)
func GetDiffChangeMessage ¶
func GetDiffChangeMessage(items []MigrateItem) string
func GetNewCountData ¶
func GetNewCountData(supabaseData []objects.Table, localData state.ExtractTableResult) int
func Migrate ¶
func Migrate(config *raiden.Config, tables []MigrateItem, stateChan chan any, actions MigrateActionFunc) []error
func PrintDiff ¶
func PrintDiff(diffData CompareDiffResult, sRelation MapRelations, tRelation MapRelations)
func PrintDiffResult ¶
func PrintDiffResult(diffResult []CompareDiffResult, sRelation MapRelations, tRelation MapRelations) error
Types ¶
type CompareDiffResult ¶
type CompareDiffResult struct {
Name string
SourceResource objects.Table
TargetResource objects.Table
DiffItems objects.UpdateTableParam
IsConflict bool
}
func CompareItem ¶
func CompareItem(mode CompareMode, source, target objects.Table) (diffResult CompareDiffResult)
func CompareList ¶
func CompareList(mode CompareMode, sourceTable, targetTable []objects.Table) (diffResult []CompareDiffResult, err error)
type CompareMode ¶ added in v1.0.0
type CompareMode string
const ( CompareModeImport CompareMode = "import" CompareModeApply CompareMode = "apply" )
type ManyToManyTable ¶
type ManyToManyTable struct {
Table string
Schema string
PivotTable string
PrimaryKey string
ForeignKey string
}
---- build table relation for generated -----
type MapRelations ¶
---- build table relation for generated -----
type MigrateActionFunc ¶
type MigrateActionFunc = migrator.MigrateActionFunc[objects.Table, objects.UpdateTableParam]
type MigrateItem ¶
type MigrateItem = migrator.MigrateItem[objects.Table, objects.UpdateTableParam]
func BuildMigrateData ¶
func BuildMigrateData(extractedLocalData state.ExtractTableResult, supabaseData []objects.Table, allowedTable []string) (migrateData []MigrateItem, err error)
func BuildMigrateItem ¶
func BuildMigrateItem(supabaseData, localData []objects.Table) (migratedData []MigrateItem, err error)
Click to show internal directories.
Click to hide internal directories.