utils

package
v0.0.0-...-0edd864 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright (c) YugaByte, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugaByte, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright (c) YugaByte, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	TABLE_MIGRATION_NOT_STARTED = iota
	TABLE_MIGRATION_IN_PROGRESS
	TABLE_MIGRATION_DONE
	TABLE_MIGRATION_COMPLETED
)

Variables

View Source
var DoNotPrompt bool
View Source
var WaitChannel = make(chan int)
View Source
var WaitGroup sync.WaitGroup

Functions

func AskPrompt

func AskPrompt(args ...string) bool

func CleanDir

func CleanDir(dir string)

func ClearMatchingFiles

func ClearMatchingFiles(filePattern string)

func CsvStringToSlice

func CsvStringToSlice(str string) []string

func ErrExit

func ErrExit(formatString string, args ...interface{})

func FileOrFolderExists

func FileOrFolderExists(path string) bool

func GetObjectDirPath

func GetObjectDirPath(schemaDirPath string, objType string) string

func GetObjectFileName

func GetObjectFileName(schemaDirPath string, objType string) string

func GetObjectFilePath

func GetObjectFilePath(schemaDirPath string, objType string) string

func GetObjectNameListFromReport

func GetObjectNameListFromReport(report Report, objType string) []string

func GetSchemaObjectList

func GetSchemaObjectList(sourceDBType string) []string

func GetSortedKeys

func GetSortedKeys(tablesProgressMetadata map[string]*TableProgressMetadata) []string

func IsDirectoryEmpty

func IsDirectoryEmpty(pathPattern string) bool

func IsQuotedString

func IsQuotedString(str string) bool

func PrettifyHtmlString

func PrettifyHtmlString(htmlStr string) string

func PrettifyJsonString

func PrettifyJsonString(jsonStr string) string

func PrintAndLog

func PrintAndLog(formatString string, args ...interface{})

func PrintIfTrue

func PrintIfTrue(message string, args ...bool)

func Readline

func Readline(r *bufio.Reader) (string, error)

func Wait

func Wait(args ...string)

Types

type DBObject

type DBObject struct {
	ObjectType   string `json:"objectType"`
	TotalCount   int    `json:"totalCount"`
	InvalidCount int    `json:"invalidCount"`
	ObjectNames  string `json:"objectNames"`
	Details      string `json:"details"`
}

type ExportMetaInfo

type ExportMetaInfo struct {
	SourceDBType   string
	ExportToolUsed string
}

type Issue

type Issue struct {
	ObjectType   string `json:"objectType"`
	ObjectName   string `json:"objectName"`
	Reason       string `json:"reason"`
	SqlStatement string `json:"sqlStatement"`
	FilePath     string `json:"filePath"`
	Suggestion   string `json:"suggestion"`
	GH           string `json:"GH"`
}

type Report

type Report struct {
	Summary Summary `json:"summary"`
	Issues  []Issue `json:"issues"`
}

report.json format

func ParseJsonFromString

func ParseJsonFromString(jsonString string) Report

type Summary

type Summary struct {
	DBName     string     `json:"dbName"`
	SchemaName string     `json:"schemaName"`
	DBVersion  string     `json:"dbVersion"`
	DBObjects  []DBObject `json:"databaseObjects"`
}

type TableProgressMetadata

type TableProgressMetadata struct {
	TableSchema          string
	TableName            string
	FullTableName        string
	InProgressFilePath   string
	FinalFilePath        string
	Status               int //(0: NOT-STARTED, 1: IN-PROGRESS, 2: DONE, 3: COMPLETED)
	CountLiveRows        int64
	CountTotalRows       int64
	FileOffsetToContinue int64 // This might be removed later
	IsPartition          bool
	ParentTable          string
}

Jump to

Keyboard shortcuts

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