artransfer

package
v0.0.0-...-476b199 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArtransImporter = &_ArtransImporter{
	ImporterInfo: ImporterInfo{
		Name: "artrans",
		Desc: "从 Artrans 导入数据",
		Note: "",
	},
}
View Source
var Assumeyes bool = false
View Source
var ExampleImporter = &_ExampleImporter{
	ImporterInfo: ImporterInfo{
		Name: "example",
		Desc: "从 Example 导入数据",
		Note: "",
	},
}
View Source
var HttpOutput func(continueRun bool, text string)
View Source
var HttpOutputEchoCtx echo.Context // TODO 只支持单线执行,同时请求两个地方会出问题

Functions

func CheckIfJsonArr

func CheckIfJsonArr(str string) bool

func CheckIfJsonObj

func CheckIfJsonObj(str string) bool

func Confirm

func Confirm(s string) bool

func ExportArtransString

func ExportArtransString(dbScopes ...func(*gorm.DB) *gorm.DB) (string, error)

func GetArrayParamsFrom

func GetArrayParamsFrom(payload []string, key string) []string

func GetParamsFrom

func GetParamsFrom(payload []string) _getParamsTo

func HideJsonLongText

func HideJsonLongText(key string, text string) string

func ImportArtrans

func ImportArtrans(basic *BasicParams, srcComments []model.Artran)

func ImportArtransByStr

func ImportArtransByStr(basic *BasicParams, str string)

func JsonDecodeFAS

func JsonDecodeFAS(str string, fasStructure interface{}) error

Json Decode (FAS: Fields All String Type) 解析 json 为字段全部是 string 类型的 struct

func JsonFileReady

func JsonFileReady(payload []string) (string, error)

func ParseDate

func ParseDate(s string) time.Time

func PrintEncodeData

func PrintEncodeData(dataType string, val interface{})

func PrintTable

func PrintTable(rows [][]interface{})

func RebuildRid

func RebuildRid(idChanges map[uint]uint)

传入 ID 变更表 (原始ID => 数据库已存在记录的ID) rid 将根据此替换

func RequiredBasicTargetSite

func RequiredBasicTargetSite(basic *BasicParams) error

func RunImportArtrans

func RunImportArtrans(payload []string)

func SiteReady

func SiteReady(tSiteName string, tSiteUrls string) (model.Site, error)

站点准备

func SprintEncodeData

func SprintEncodeData(dataType string, val interface{}) string

func TryConvertLineJsonToArr

func TryConvertLineJsonToArr(str string) (string, error)

func UrlResolverGetPageKey

func UrlResolverGetPageKey(baseUrlRaw string, commentUrlRaw string) string

PageKey (commentUrlVal 不确定是否为完整 URL 还是一个 path)

@examples ("https://github.com", "/1.html") => "https://github.com/1.html" ("https://github.com", "https://xxx.com/1.html") => "https://github.com/1.html" ("https://github.com/", "/1.html") => "https://github.com/1.html" ("", "/1.html") => "/1.html" ("", "https://xxx.com/1.html") => "https://xxx.com/1.html" ("https://github.com/233", "/1/") => "https://github.com/1/"

Types

type BasicParams

type BasicParams struct {
	TargetSiteName string
	TargetSiteUrl  string

	UrlResolver bool
}

func GetBasicParamsFrom

func GetBasicParamsFrom(payload []string) *BasicParams

type ImporterInfo

type ImporterInfo struct {
	Name string
	Desc string
	Note string
}

func GetImporterInfo

func GetImporterInfo(instance interface{}) ImporterInfo

Jump to

Keyboard shortcuts

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