types

package
v1.0.0-beta.39 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DiffChangeTemplate = `` /* 321-byte string literal not displayed */
View Source
const DiffChangeUpdateTemplate = `` /* 166-byte string literal not displayed */
View Source
const DiffTemplate = `` /* 241-byte string literal not displayed */

----- generate message section ------

View Source
const FuncBodyTemplate = "{{ .Symbol }} return {{ .Value }}"
View Source
const FuncBodyUpdateTemplate = "{{ .Symbol }} return {{ .Value }}  >>> {{ .ChangeValue }}"

Variables

View Source
var ActionFunc = MigrateActionFunc{
	CreateFunc: func(cfg *raiden.Config, param objects.Type) (response objects.Type, err error) {
		if cfg.Mode == raiden.SvcMode {
			return pgmeta.CreateType(cfg, param)
		}
		return supabase.CreateType(cfg, param)
	},
	UpdateFunc: func(cfg *raiden.Config, param objects.Type, items objects.UpdateTypeParam) (err error) {
		if cfg.Mode == raiden.SvcMode {
			return pgmeta.UpdateType(cfg, param)
		}
		return supabase.UpdateType(cfg, param)
	},
	DeleteFunc: func(cfg *raiden.Config, param objects.Type) (err error) {
		if cfg.Mode == raiden.SvcMode {
			return pgmeta.DeleteType(cfg, param)
		}
		return supabase.DeleteType(cfg, param)
	},
}
View Source
var Logger hclog.Logger = logger.HcLog().Named("resource.types")

Functions

func Compare

func Compare(source []objects.Type, target []objects.Type) error

func GenerateDiffChangeMessage

func GenerateDiffChangeMessage(newData []string, updateData []string, deleteData []string) (string, error)

func GenerateDiffChangeUpdateMessage

func GenerateDiffChangeUpdateMessage(name string, item MigrateItem) (string, error)

func GenerateDiffMessage

func GenerateDiffMessage(name string, diffType DiffType, updateType objects.UpdateDataType, value string, changeValue string) (string, error)

func GetDiffChangeMessage

func GetDiffChangeMessage(items []MigrateItem) string

func GetNewCountData

func GetNewCountData(supabaseData []objects.Type, localData state.ExtractTypeResult) int

func Migrate

func Migrate(config *raiden.Config, dataType []MigrateItem, stateChan chan any, actions MigrateActionFunc) []error

func PrintDiff

func PrintDiff(diffData CompareDiffResult)

func PrintDiffResult

func PrintDiffResult(diffResult []CompareDiffResult) error

Types

type CompareDiffResult

type CompareDiffResult struct {
	Name           string
	SourceResource objects.Type
	TargetResource objects.Type
	DiffItems      objects.UpdateTypeParam
	IsConflict     bool
}

func CompareItem

func CompareItem(source, target objects.Type) (diffResult CompareDiffResult)

func CompareList

func CompareList(sourceType, targetType []objects.Type) (diffResult []CompareDiffResult, err error)

type DiffType

type DiffType string

----- print diff section -----

const (
	DiffTypeCreate DiffType = "create"
	DiffTypeUpdate DiffType = "update"
	DiffTypeDelete DiffType = "delete"
)

type MigrateItem

func BuildMigrateData

func BuildMigrateData(extractedLocalData state.ExtractTypeResult, supabaseData []objects.Type) (migrateData []MigrateItem, err error)

func BuildMigrateItem

func BuildMigrateItem(supabaseData []objects.Type, localData []objects.Type) (migratedData []MigrateItem, err error)

Jump to

Keyboard shortcuts

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