convert

package
v0.2.35 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NeedNotUpdateFieldSet *set.StringSet
	NeedGenerateFieldSet  *set.StringSet
)

Functions

func FromExcelSheet added in v0.2.30

func FromExcelSheet(c *Columns, sheet *xlsx.Sheet, db *sql.DB, dataStartRow int, driverName, tableName string,
	sheetIndex string, debug bool, useNull4BlankColumn bool) (modifiedIds []int, resultValues []string, err error)

func FromExcelSheetWithResult added in v0.2.30

func FromExcelSheetWithResult(c *Columns, sheet *xlsx.Sheet, db *sql.DB, dataStartRow int, driverName, tableName string,
	sheetIndex string, debug bool, useNull4BlankColumn bool, resultFieldName string) (modifiedIds []int,
	resultValues []string, err error)

func FromJson

func FromJson(c *Columns, dataMap []map[string]interface{}, db *sql.DB, driverName, tableName string,
	titles []StringValue, debug bool) (err error)

func GetTableColumns

func GetTableColumns(db *sql.DB, driverName, tableName string) (tableColumnMap map[int]string, err error)

func GetUpdateSql

func GetUpdateSql(driverName, tableName string, fieldNames []string, values []string,
	needConflictOnFields string, updatedFieldSet *set.StringSet,
	distinctExcludedFieldSet *set.StringSet) (sql string, updateSetSql string, whereSql string)

func IncreaseTableIdSeq added in v0.2.30

func IncreaseTableIdSeq(db *sql.DB, tableName string) (rows *sql.Rows, err error)

更新id自增长值导入数据成功

func JsonToDB

func JsonToDB(db *sql.DB, driverName, tableName, jsonFileName string, titles []StringValue, debug bool) (err error)

func ParseValue

func ParseValue(val string) (result string, needUpdate bool)

解析内容

func Substr

func Substr(str string, start int, length int) string

按长度截取字符串

Types

type Columns

type Columns struct {
	// contains filtered or unexported fields
}

func (*Columns) ParseColumns

func (c *Columns) ParseColumns() (err error)

解析Excel及数据库字段

type DBRow

type DBRow struct {
	// contains filtered or unexported fields
}

数据库行

type OtherTable

type OtherTable struct {
	// contains filtered or unexported fields
}

附表

type ResultStruct added in v0.2.30

type ResultStruct struct {
	SheetIndex  int
	Results     []string
	ModifiedIds []int
	Err         error
}

func ExcelToDB

func ExcelToDB(db *sql.DB, driverName, tableName, excelFileName, sheets string, dataStartRow int, debug bool,
	useNull4BlankColumn bool) (resultValues []ResultStruct, err error)

func XlFileToDB added in v0.2.28

func XlFileToDB(db *sql.DB, driverName, tableName string, xlFile *xlsx.File, sheets string, dataStartRow int,
	debug bool, useNull4BlankColumn bool) (resultValues []ResultStruct, err error)

func XlFileToDBWithResult added in v0.2.28

func XlFileToDBWithResult(db *sql.DB, driverName, tableName string, xlFile *xlsx.File, sheets string, dataStartRow int,
	debug bool, useNull4BlankColumn bool, resultFieldName string) (resultValues []ResultStruct, err error)

type StringValue

type StringValue struct {
	Value string
}

func (StringValue) String

func (sv StringValue) String() string

type StringValueInterface

type StringValueInterface interface {
	String() string
}

Jump to

Keyboard shortcuts

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