Documentation
¶
Index ¶
- Constants
- Variables
- func AppendFileStream(filePath string, destinationFile *os.File) (int64, error)
- func ConvertApiAuthProto(auth *common.ApiAuth) *openapi3_util.Auth
- func ConvertApiAuthWebRequestProto(auth *common.ApiAuthWebRequest) (*openapi3_util.Auth, error)
- func Date2Time(date string) (int64, error)
- func DateRange(startTs, endTs int64) []string
- func DecryptAES(src []byte, key, iv []byte) ([]byte, error)
- func DeleteDirFile(fileDir string) error
- func DeleteFile(file string) error
- func DirFileList(dir string, subDir bool, fullPath bool) ([]string, error)
- func Exist[T ~int | ~int32 | ~uint32 | ~int64 | ~string](arr []T, n T) bool
- func FileEOF(err error) bool
- func FileExist(filePath string) (bool, error)
- func FileExt(filePath string) string
- func GenApiUUID() string
- func GenUUID() string
- func I32(s string) (int32, error)
- func I64(s string) (int64, error)
- func InitTimeLocal() error
- func InitValidator() error
- func Int2Str[T ~int | ~int32 | ~uint32 | ~int64](i T) string
- func IsAlphanumeric(input string) bool
- func LoadConfig(in string, cfg interface{}) error
- func MD5(str []byte) string
- func Md2html(markdown []byte) (string, error)
- func MustI32(s string) int32
- func MustI64(s string) int64
- func MustU32(s string) uint32
- func PreviousDateRange(startDate, endDate string) ([]string, []string, error)
- func PrintPanicStack()
- func PrintPanicStackWithCall(postProcessor func(panicOccur bool, recoverError error))
- func SHA256(src string) string
- func Str2Date(timeStr string) (int64, error)
- func Str2Time(timeStr string) (int64, error)
- func Time2Date(ts int64) string
- func Time2MsStr(millSec int64) string
- func Time2Str(millSec int64) string
- func ToFileSizeStr(fileSize int64) string
- func U32(s string) (uint32, error)
- func Validate(s interface{}) error
- func WeekStartTime(t time.Time, week int) time.Time
- type ApiAuthWebRequest
- type FileMergeResult
Constants ¶
View Source
const ( AuthTypeNone = "none" AuthTypeAPIKeyQuery = "api_key_query" AuthTypeAPIKeyHeader = "api_key_header" ApiKeyHeaderPrefixBasic = "basic" ApiKeyHeaderPrefixBearer = "bearer" ApiKeyHeaderPrefixCustom = "custom" ApiKeyHeaderDefault = "Authorization" )
api 鉴权
View Source
const (
MaxScanTokenSize = 1024 * 1024 // Set the maximum token size to 1 MB
)
Variables ¶
View Source
var UTC8 *time.Location
Functions ¶
func AppendFileStream ¶
func ConvertApiAuthProto ¶ added in v0.2.6
func ConvertApiAuthProto(auth *common.ApiAuth) *openapi3_util.Auth
func ConvertApiAuthWebRequestProto ¶ added in v0.2.6
func ConvertApiAuthWebRequestProto(auth *common.ApiAuthWebRequest) (*openapi3_util.Auth, error)
func DeleteDirFile ¶
func DeleteFile ¶
func GenApiUUID ¶
func GenApiUUID() string
func InitTimeLocal ¶
func InitTimeLocal() error
func LoadConfig ¶
func PreviousDateRange ¶ added in v0.2.5
返回上一个周期和当前周期闭区间日期列表
func PrintPanicStack ¶
func PrintPanicStack()
PrintPanicStack recover并打印堆栈 用法:defer util.PrintPanicStack(),注意 defer func() { util.PrintPanicStack() } 是无效的
func PrintPanicStackWithCall ¶
func Time2MsStr ¶
func ToFileSizeStr ¶
ToFileSizeStr fileSize单位是B,转换规则:小于1M为KB,大于等于1M,单位为M,保留两位小数
Types ¶
type ApiAuthWebRequest ¶ added in v0.2.6
type ApiAuthWebRequest struct {
AuthType string `json:"authType" validate:"required,oneof='none' 'api_key_query' 'api_key_header'"` // 鉴权类型 None 或 请求头 或 查询参数
ApiKeyHeaderPrefix string `json:"apiKeyHeaderPrefix" validate:"omitempty,oneof='basic' 'bearer' 'custom'"` // 鉴权头部前缀
ApiKeyHeader string `json:"apiKeyHeader"` // HTTP头部名称
ApiKeyQueryParam string `json:"apiKeyQueryParam"` // 查询参数名称
ApiKeyValue string `json:"apiKeyValue"` // apiKey
}
func (*ApiAuthWebRequest) Check ¶ added in v0.2.6
func (req *ApiAuthWebRequest) Check() error
func (*ApiAuthWebRequest) ToOpenapiAuth ¶ added in v0.2.6
func (auth *ApiAuthWebRequest) ToOpenapiAuth() (*openapi3_util.Auth, error)
Click to show internal directories.
Click to hide internal directories.