util

package
v0.0.0-...-70044d4 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: GPL-3.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CompletionName = "notfound.1"
View Source
var HostName = "notfound.0"
View Source
var QueryPathMapper = map[string]string{}

Functions

func BatchAdd

func BatchAdd(DB *gorm.DB, insertDataArray *[]interface{}, dontReplaceField []string) (int64, error)

func BatchAddOnlyInsertField

func BatchAddOnlyInsertField(DB *gorm.DB, insertDataArray *[]interface{}, dontReplaceField []string) (int64, error)

func BootstrapHttp

func BootstrapHttp(
	needCrypto bool,
	projectName string,
	customRouterFunc func(*gin.Engine) *gin.Engine,
	apiRouterFunc func(*gin.Engine) *gin.Engine,
) *http.Server

func BytesCombine

func BytesCombine(pBytes ...[]byte) []byte

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

func CompareString

func CompareString(v1 interface{}, v2 interface{}) bool

func DaysOfMonth

func DaysOfMonth(year int, month int) (days int)

func DefaultView

func DefaultView(ctx *gin.Context)

func DeleteNumberAtArr

func DeleteNumberAtArr(number int, list ...interface{}) []interface{}

func DeleteNumberAtArray

func DeleteNumberAtArray(listParameter interface{}, number int) interface{}

func Difference

func Difference(slice1, slice2 []string) []string

func ErrorCatch

func ErrorCatch(err error, errorMessage string, c *gin.Context) bool

func ErrorCatchEncryption

func ErrorCatchEncryption(err error, errorMessage string, c *gin.Context) bool

func Get

func Get(inputBytes []byte, inputType interface{}) (i interface{}, err error)

func GetCode

func GetCode(chinese string) string

func GetConfigStringList

func GetConfigStringList(c *config.Config, key string) []string

func GetCurrentDirectory

func GetCurrentDirectory() string

func GetCurrentPath

func GetCurrentPath() (string, error)

func GetCurrentPathWithoutError

func GetCurrentPathWithoutError() string

func GetDetailDayByMonth

func GetDetailDayByMonth(monthNo int) []string

func GetFileFromMultipart

func GetFileFromMultipart(OssSavedObject *io.Reader, fileInformation *UploadFileInformation) (io.Reader, error)

func GetFileWriter

func GetFileWriter(fileInformation *UploadFileInformation) io.Writer

func GetItfFromYml

func GetItfFromYml(path string) interface{}

func GetMemoryWriter

func GetMemoryWriter() io.Writer

func GetMemoryWriter2

func GetMemoryWriter2() io.Writer

func GetOrderMatch

func GetOrderMatch(primaryKeyName string, orderString string) string

func GetOrderSpecify

func GetOrderSpecify(inputString string) bool

func GetOrderString

func GetOrderString(primaryKeyName string) string

func GetQueryOptionFromContext

func GetQueryOptionFromContext(context *gin.Context)

func GetRawString

func GetRawString(context *gin.Context) []byte

func GetRouter

func GetRouter(
	needCrypto bool,
	ConfigCustomRouter func(*gin.Engine) *gin.Engine,
	apiRouterConfig func(*gin.Engine) *gin.Engine,
) *gin.Engine

func GetString

func GetString(str interface{}) string

func GetWithoutError

func GetWithoutError(inputBytes []byte, inputType interface{}) (i interface{})

func GinToLogrus

func GinToLogrus() gin.HandlerFunc

func HealthCheckDatabase

func HealthCheckDatabase(ctx *gin.Context)

HealthCheckDatabase @Summary HealthCheckDatabase @Description HealthCheckDatabase @Produce application/json @Router /health [GET]

func InitHookServerHost

func InitHookServerHost(queryPath string) (string, string)

func InitValidationServerHost

func InitValidationServerHost() string

func Intersect

func Intersect(slice1, slice2 []string) []string

func JsonParse

func JsonParse(input interface{}) []byte

func JsonQuickParse

func JsonQuickParse(input interface{}) []byte

func Logger

func Logger() gin.HandlerFunc

func MD5

func MD5(inputBytes []byte) string

func MatchAggregate

func MatchAggregate(aggregate string) string

func Md5Sum

func Md5Sum(str string) string

func MergeMapToKey

func MergeMapToKey(jobMap map[string]interface{}, amalgamate []map[string]int) map[string]interface{}

INPUT [{a:*},{b:*}] [{ATTR1:1},{ATTR1:2}] OUTPUT [{a:{ATTR1:1}},{b:{ATTR1:2}}]

func MergeProperties

func MergeProperties(originInterface interface{}, propertiesInterface ...interface{}) interface{}

func MergeToMap

func MergeToMap(mergeMap []map[string]int, keyStr string, keyList []int) []map[string]int

** INPUT [{},{}] ATTR1 [1,2] OUT [{ATTR1:1},{ATTR1:2}]

func MustJSONDecode

func MustJSONDecode(b []byte, i interface{}) (err error)

func NoMethodHandle

func NoMethodHandle() gin.HandlerFunc

func NoMethodHandler

func NoMethodHandler(context *gin.Context)

func NoRouterHandle

func NoRouterHandle() gin.HandlerFunc

func NoRouterHandler

func NoRouterHandler(context *gin.Context)

func PostRequestHook

func PostRequestHook(hookPath string, requestBody []byte, token string, hookUrl string, requestPath string, requestMethod string, extraString string) error

func PreRequestCheck

func PreRequestCheck(checkUrl string, requestBody []byte) error

func RandNumber

func RandNumber(min int, max int) int

func RandString

func RandString(input string) int

func RandomDay

func RandomDay(allMonthDay []string, randomNumber int) []string

func ReParkFile

func ReParkFile(OssSavedObject *io.Reader, fileInformation *UploadFileInformation) (io.Writer, error)

func RecursionListFile

func RecursionListFile(fileName string, resultFileList *[]string, pattern *string) ([]string, error)

func RemoveReplicationString

func RemoveReplicationString(slc []string) []string

func RemoveReplicationStringByLoop

func RemoveReplicationStringByLoop(slc []string) []string

func RemoveReplicationStringByMap

func RemoveReplicationStringByMap(slc []string) []string

func ReplaceTarGz

func ReplaceTarGz(OssSavedObject *io.Reader, fileInformation *UploadFileInformation) (io.Writer, error)

func RequestLogger

func RequestLogger() gin.HandlerFunc

func StringToCode

func StringToCode(text string, maxLength int) string

func StringToDateCode

func StringToDateCode(text string, maxLength int) string

func StringToUnixCode

func StringToUnixCode(text string, maxLength int) string

func UniformityRand

func UniformityRand(total int, min int, max int, median int) []int

func UniformityRandString

func UniformityRandString(total int, input string) []int

func UniformityRandomNumber

func UniformityRandomNumber(total int, min int, max int, median int, average int) []int

func Union

func Union(slice1, slice2 []string) []string

func UploadToOss

func UploadToOss(ossConnection *oss.Client, ossBucket *oss.Bucket, writer io.Writer, fileUrl string) (*oss.Response, error)

func ValidSQLSting

func ValidSQLSting(input string) string

func VersionHandler

func VersionHandler() gin.HandlerFunc

func WorkDayOfMonth

func WorkDayOfMonth(currentTime string) ([]interface{}, int)

Types

type BatchInsertDB

type BatchInsertDB struct {
	*gorm.DB
}

func (*BatchInsertDB) BatchInsertWrapper

func (db *BatchInsertDB) BatchInsertWrapper(objArr *[]interface{}, dontReplaceField []string) (int64, error)

type BatchInsertDBOnlyInsertField

type BatchInsertDBOnlyInsertField struct {
	*gorm.DB
}

func (*BatchInsertDBOnlyInsertField) BatchInsertWrapperOnlyInsertField

func (db *BatchInsertDBOnlyInsertField) BatchInsertWrapperOnlyInsertField(objArr *[]interface{}, dontReplaceField []string) (int64, error)

type FileInfo

type FileInfo struct {
	Name     string
	Size     int64
	ModTime  time.Time
	TypeFlag byte
	Mode     int64
}

func FileNameListInTarGzContent

func FileNameListInTarGzContent(OssSavedObject *io.Reader) ([]*FileInfo, error)

func FileNameListInTarGzContentByte

func FileNameListInTarGzContentByte(buf io.Reader) ([]*FileInfo, error)

type I64

type I64 struct {
	Value int64
}

type KeyValueSort

type KeyValueSort struct {
	Key   string
	Value int
}

func SortMap

func SortMap(m map[string]int) []KeyValueSort

type NUM

type NUM struct {
	Value int
}

type RequestOption

type RequestOption struct {
	Page        int      `json:"page" description:"页码"`
	PageSize    int      `json:"pageSize" description:"分页大小"`
	Relation    bool     `json:"relation" description:"决定是否查询关联类"`
	State       string   `json:"state" description:"查询:强制查询state的值、修改和插入:"`
	Specify     bool     `json:"specify" description:"精确查询"`
	AutoRank    bool     `json:"autoRank" description:"自动排序"`
	Order       string   `json:"order" description:"排序方式"`
	Count       string   `json:"count"  description:"按条件计算个数"`
	Strict      bool     `` /* 185-byte string literal not displayed */
	Aggregate   string   `json:"aggregate" description:"聚合方式,left/right/full"`
	ReturnField []string `json:"field" description:"返回的字段"`
	Timeout     int      `json:"timeout" description:"查询超时"`
}

type STR

type STR struct {
	Value string
}

func (*STR) String

func (self *STR) String() string

type UploadFileInformation

type UploadFileInformation struct {
	File           *multipart.FileHeader
	OssBucketName  string
	OssPackageFile string
	FileMd5        string
	FileSize       int64
	OssContentFile string
	NotUseMemory   bool
	FileList       []string
	CheckFile      func(io.Reader) error
	SumMd5         bool
	MaxKeys        int64
}

type UploadFileInformationRes

type UploadFileInformationRes struct {
	OssBucketName  string
	OssStorageFile string
	FileMd5        string
	FileSize       int64
	Host           string
	FileName       string
}

type ValSorter

type ValSorter struct {
	KeyList []string
	ValList []int
}

func NewValSorter

func NewValSorter(m map[string]int) *ValSorter

func (*ValSorter) Len

func (vs *ValSorter) Len() int

func (*ValSorter) Less

func (vs *ValSorter) Less(i, j int) bool

func (*ValSorter) Sort

func (vs *ValSorter) Sort()

func (*ValSorter) Swap

func (vs *ValSorter) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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