utils

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FILE_EXT_SHP = ".shp"
	FILE_EXT_CPG = ".cpg"

	FILE_EXT_TXT = ".txt"

	UTF8  = "UTF8"
	UTF_8 = "UTF-8"
)
View Source
const (
	ZIP_EXT = ".zip"
)

Variables

View Source
var (
	ErrAbsoluteZipPath = errors.New("absolute zip path")
)
View Source
var (
	ErrNoShpInZip = errors.New("no shp in zip")
)

Functions

func B2S

func B2S(b []byte) string

func BsToHex

func BsToHex(s string) string

func CheckSQLTextValue

func CheckSQLTextValue(s string) bool

anti SQL injection

func CompressFiles

func CompressFiles(dest string, src ...string) (err error)

CompressFiles 打包任意个文件 src 输入的文件路径列表 dest zip文件存放路径

func CompressZip

func CompressZip(dest, srcDir string) (err error)

CompressZip 打包任意文件夹 srcDir 输入的文件夹相对路径 dest zip文件存放路径

func ContainsAll

func ContainsAll(group, sub []string) bool

func ContainsAny

func ContainsAny(group, sub []string) bool

func GbkStrToUtf8

func GbkStrToUtf8(s string) (d string, e error)

GBK string 转 UTF-8

func GbkToUtf8

func GbkToUtf8(s []byte) (d []byte, e error)

GBK 转 UTF-8

func GetBasicBandIdx

func GetBasicBandIdx(bandOrder string) (idx [3]string, invalid bool)

func GetDateSubDir

func GetDateSubDir(parentPath, date string) (path string, err error)

func GetDistrictInShpName

func GetDistrictInShpName(shp string) (district string)

func GetFilenameWithoutExt

func GetFilenameWithoutExt(path string) (name string)

func GetNowTimeTag

func GetNowTimeTag() string

func GetShpInZip

func GetShpInZip(zipFile, dstDir string) (path string, utf8 bool, err error)

func GetUniqSubDir

func GetUniqSubDir(parentPath string) (path string, err error)

func Int64sToStr

func Int64sToStr(ids []int64, sep byte) string

func IsZip

func IsZip(fp string) bool

func PurifyForUtf8

func PurifyForUtf8(s string) string

func ReplaceUnderline

func ReplaceUnderline(s string) string

func S2B

func S2B(s string) []byte

func StrArrToInts

func StrArrToInts(ss []string) []int

func StrToInt

func StrToInt(s string) int

func StrToInt32

func StrToInt32(s string) int32

func StrToInt64

func StrToInt64(s string) int64

func StrToInts

func StrToInts(s, sep string) []int

func StrToUint32

func StrToUint32(s string) uint32

func StrToUint64

func StrToUint64(s string) uint64

func TrimTailCommas

func TrimTailCommas(s string) string

func UInt64sToStr

func UInt64sToStr(ids []uint64, sep byte) string

func Unzip

func Unzip(archive, dstDir string) (files []string, err error)

func Utf8StrToGbk

func Utf8StrToGbk(s string) (d string, e error)

UTF-8 string 转 GBK

func Utf8ToGbk

func Utf8ToGbk(s []byte) (d []byte, e error)

UTF-8 转 GBK

Types

This section is empty.

Jump to

Keyboard shortcuts

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