methods

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: GPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APICheck

func APICheck(ip string) bool

func CalculateArea

func CalculateArea(jsonData *geojson.Feature) float64

func CalculateAreaByStr

func CalculateAreaByStr(jsonDataStr string) float64

func CalculateGeodesicArea

func CalculateGeodesicArea(jsonData *geojson.Feature) float64

func CamelCaseToUnderscore

func CamelCaseToUnderscore(str string) string

func CamelCaseToUnderscore2

func CamelCaseToUnderscore2(str string) string

func ConvertGeoJSONToDXF

func ConvertGeoJSONToDXF(featureCollection geojson.FeatureCollection, outputFilename string)

func ConvertToInitials

func ConvertToInitials(hanzi string) string

ConvertToInitials 将中文字符串转换为拼音首字母拼接字符串

func DLMCReplace

func DLMCReplace(tablename string) string

func DataSearch

func DataSearch(query *gorm.DB, jsonData map[string]interface{}) []models.TempLayHeader

func DecryptStr

func DecryptStr(encryptedB64Str string, key string) string

func DeleteFiles

func DeleteFiles(dirPath string)

删除文件夹内的所有文件

func DirectoryExists

func DirectoryExists(dirPath string, folderName string) bool

func EncryptStr

func EncryptStr(text string, key string) string

func FindShpFile

func FindShpFile(dir string, ex string) *string

func GeoIntersectLine

func GeoIntersectLine(jsonData geojson.FeatureCollection, tablename string, attributes []string, IsVolume bool) []map[string]interface{}

func GeoJsonToWKB

func GeoJsonToWKB(geo geojson.Feature) string

func GetAllFiles

func GetAllFiles(path string) ([]string, error)

func GetFieldName

func GetFieldName(i interface{}) []string

func GetIP

func GetIP(net string) []string

func GetIntersectGeo

func GetIntersectGeo(jsonData geojson.FeatureCollection, tablename string, atts string) geojson.FeatureCollection

func GetMaxItem

func GetMaxItem(text []Result) string

func GetVolume

func GetVolume(data []map[string]interface{}) []map[string]interface{}

func IsStringInSlice

func IsStringInSlice(s string, slice []string) bool

func LowerJSONTransform

func LowerJSONTransform(xmList interface{}) interface{}

func MakeGeoJSON2

func MakeGeoJSON2(items []map[string]interface{}) interface{}

func MakeTileIndex

func MakeTileIndex(DB *gorm.DB)

获取3dtiles文件名称接口

func Md5Str

func Md5Str(data string) string

func MergeMaps

func MergeMaps(map1, map2 map[string]interface{}) map[string]interface{}

mergeMaps函数负责合并两个map成一个[]map[string]interface{}

func OpenURL

func OpenURL(url string) error

func RemoveKeyFromMapArray

func RemoveKeyFromMapArray(input []map[string]interface{}, key string) []map[string]interface{}

func ReplaceInJSFiles

func ReplaceInJSFiles(dir string, oldValue string, newValue string) error

func RestoreData

func RestoreData(backupPath string)

func SavaGeojsonToDb

func SavaGeojsonToDb(db *gorm.DB, jsonData geojson.FeatureCollection, table interface{})

func SavaGeojsonToTable

func SavaGeojsonToTable(db *gorm.DB, jsonData geojson.FeatureCollection, tablename string)

func SortSchema

func SortSchema(TableSchema []models.MySchema) []models.MySchema

func TempDataSearch

func TempDataSearch(query *gorm.DB, jsonData map[string]interface{}) []models.TempGeo

func ToStringSlice

func ToStringSlice(args []interface{}) []string

func Unzip

func Unzip(src string) error

func UnzipRar

func UnzipRar(src string) error

func UnzipZip

func UnzipZip(src string) error

func UpdateGeojsonToTable

func UpdateGeojsonToTable(db *gorm.DB, jsonData geojson.FeatureCollection, tablename string, id int32)

func ZipFileOut

func ZipFileOut(folderPath string) ([]byte, error)

func ZipFolder

func ZipFolder(folderPath string, name string) error

func ZipFolderTo

func ZipFolderTo(folderPath string, outpath string) error

Types

type Att

type Att struct {
	Text  string `json:"text"`
	Value string `json:"value"`
}

type BackupConfig

type BackupConfig struct {
	Host          string
	Port          string
	User          string
	Password      string
	Database      string
	BackupDir     string
	RetentionDays int
	Compress      bool
}

BackupConfig 备份配置结构

type BackupInfo

type BackupInfo struct {
	Name        string
	Path        string
	CreatedTime time.Time
	Size        int64
}

BackupInfo 备份信息结构

type BackupStatistics

type BackupStatistics struct {
	TotalBackups   int       `json:"total_backups"`
	ValidBackups   int       `json:"valid_backups"`
	ExpiredBackups int       `json:"expired_backups"`
	TotalSize      int64     `json:"total_size"`
	ValidSize      int64     `json:"valid_size"`
	ExpiredSize    int64     `json:"expired_size"`
	RetentionDays  int       `json:"retention_days"`
	OldestBackup   time.Time `json:"oldest_backup"`
	NewestBackup   time.Time `json:"newest_backup"`
}

BackupStatistics 备份统计信息

func (*BackupStatistics) String

func (bs *BackupStatistics) String() string

格式化统计信息

type ColumnInfo

type ColumnInfo struct {
	ColumnName    string `gorm:"column:column_name"`
	DataType      string `gorm:"column:data_type"`
	IsNullable    string `gorm:"column:is_nullable"`
	ColumnDefault string `gorm:"column:column_default"`
	CharMaxLength int    `gorm:"column:character_maximum_length"`
}

ColumnInfo 列信息结构

type FieldService

type FieldService struct{}

func NewFieldService

func NewFieldService() *FieldService

func (*FieldService) AddField

func (fs *FieldService) AddField(tableName, fieldName, fieldType string, length int, defaultValue, comment string, isNullable bool) error

AddField 添加字段

func (*FieldService) CheckFieldExists

func (fs *FieldService) CheckFieldExists(tableName, fieldName string) bool

CheckFieldExists 检查字段是否存在

func (*FieldService) CheckTableExists

func (fs *FieldService) CheckTableExists(tableName string) bool

CheckTableExists 检查表是否存在

func (*FieldService) DeleteField

func (fs *FieldService) DeleteField(tableName, fieldName string) error

DeleteField 删除字段

func (*FieldService) GetSingleFieldInfo

func (fs *FieldService) GetSingleFieldInfo(tableName, fieldName string) (*models.FieldInfo, error)

GetSingleFieldInfo 获取单个字段信息

func (*FieldService) GetTableList

func (fs *FieldService) GetTableList() ([]string, error)

GetTableList 获取数据库中所有表的列表

func (*FieldService) GetTableStructure

func (fs *FieldService) GetTableStructure(tableName string) (*models.TableStructure, error)

GetTableStructure 获取表结构信息

func (*FieldService) ModifyField

func (fs *FieldService) ModifyField(tableName, oldFieldName, newFieldName, fieldType string, length int, defaultValue, comment string, isNullable bool) error

ModifyField 修改字段

type Res

type Res struct {
	ColumnName string
}

type RestoreConfig

type RestoreConfig struct {
	Host         string
	Port         string
	User         string
	Password     string
	Database     string
	BackupPath   string
	DropExisting bool // 是否删除现有数据
	RestoreData  bool // 是否恢复数据
	Verbose      bool // 详细日志
}

RestoreConfig 恢复配置结构

type RestoreResult

type RestoreResult struct {
	Success          bool
	TablesCreated    int
	DataRestored     int
	IndexesCreated   int
	ViewsCreated     int
	FunctionsCreated int
	Errors           []string
	Duration         time.Duration
}

RestoreResult 恢复结果

type Result

type Result struct {
	Area          float64 // 假设 area 指的是一个面积,使用 float64 类型来接收
	Dlmc          string  // 假设 dlmc 是一个字符串
	AttributeName string  // 额外的动态字段名,仅在程序内部使用
}

func GeoIntersect

func GeoIntersect(jsonData geojson.FeatureCollection, tablename string, att string) []Result

func GeoIntersectForBG

func GeoIntersectForBG(jsonData geojson.FeatureCollection, tablename string, att string) []Result

func GroupAndSum

func GroupAndSum(data []Result) []Result

type SQLBackupManager

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

SQLBackupManager SQL备份管理器

func NewSQLBackupManager

func NewSQLBackupManager() (*SQLBackupManager, error)

NewSQLBackupManager 创建SQL备份管理器

func (*SQLBackupManager) GetBackupStatistics

func (sbm *SQLBackupManager) GetBackupStatistics() (*BackupStatistics, error)

GetBackupStatistics 获取备份统计信息

func (*SQLBackupManager) PerformSQLBackup

func (sbm *SQLBackupManager) PerformSQLBackup() error

PerformSQLBackup 执行SQL备份

type SQLRestoreManager

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

SQLRestoreManager SQL恢复管理器

func NewSQLRestoreManager

func NewSQLRestoreManager(backupPath string) (*SQLRestoreManager, error)

NewSQLRestoreManager 创建SQL恢复管理器

func (*SQLRestoreManager) PerformRestore

func (srm *SQLRestoreManager) PerformRestore() (*RestoreResult, error)

PerformRestore 执行完整恢复

func (*SQLRestoreManager) SetRestoreOptions

func (srm *SQLRestoreManager) SetRestoreOptions(dropExisting, restoreData, verbose bool)

SetRestoreOptions 设置恢复选项

type TableInfo

type TableInfo struct {
	TableName  string `gorm:"column:table_name"`
	SchemaName string `gorm:"column:table_schema"`
	TableType  string `gorm:"column:table_type"`
	RowCount   int64  `gorm:"column:row_count"`
}

TableInfo 表信息结构

Jump to

Keyboard shortcuts

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