util

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	KnowledgeImportFileFormatErr    = "know_doc_unsupported_file_format"
	KnowledgeImportFileSizeErr      = "know_doc_file_size_exceed"
	KnowledgeImportSameNameErr      = "know_same_name_validation_fail"
	KnowledgeDocLastFailureErr      = "know_doc_last_failure_info"
	KnowledgeDocParsingServiceErr   = "know_doc_parsing_service_error"
	KnowledgeDocVectorDuplicateErr  = "know_doc_vector_duplicate_error"
	KnowledgeDocDuplicateErr        = "know_doc_duplicate_error"
	KnowledgeDocDownloadErr         = "know_doc_download_error"
	KnowledgeDocSplitErr            = "know_doc_split_error"
	KnowledgeDocEmbeddingErr        = "know_doc_embedding_error"
	KnowledgeDocTextErr             = "know_doc_text_error"
	KnowledgeDocEmptyFileContentErr = "know_doc_empty_file_content"
	KnowledgeDocFileUnUsableErr     = "know_doc_file_unusable"
)

Variables

This section is empty.

Functions

func BuildAnalyzingStatus

func BuildAnalyzingStatus() []int

func BuildDocErrMessage

func BuildDocErrMessage(status int) string

BuildDocErrMessage 构造文档错误信息

func BuildDocReqStatusList

func BuildDocReqStatusList(status int) []int

func BuildDocRespStatus

func BuildDocRespStatus(number int) int

BuildDocRespStatus rag 1.0 状态码和rag 2.0状态码转换关系如下: rag 2.0 ---> rag 1.0 1 ---> 1 10 ---> 1 2 ---> 2 31-35 ---> 3 4 ---> 4 51-56 ---> 5 61-69 ---> 5

func BuildFilePath

func BuildFilePath(fileDir, fileExt string) string

func DivideAndRemainder

func DivideAndRemainder(dividend, divisor int) (quotient, remainder int)

int型除法。第一返回值为商,第二为余

func ErrCode

func ErrCode(code err_code.Code) error

func ErrStatus

func ErrStatus(code err_code.Code, status *err_code.Status) error

func FileEOF

func FileEOF(err error) bool

func GetPageTotal

func GetPageTotal(len, pageSize int) int

len 一共101组数据,每页8个,那么需要 12+1=13页

func HasDuplicate added in v0.1.4

func HasDuplicate(a, b []string) bool

HasDuplicate 判断两个数组是否有交集时间复杂度o(m*n)

func HasIntersection added in v0.1.6

func HasIntersection(arr1, arr2 []string) bool

HasIntersection 判断两个数组是否有交集时间复杂度o(m+n)

func InLst

func InLst(item string, lst []string) bool

func Intersection

func Intersection[T comparable](slice1, slice2 []T) []T

Intersection 函数用于找出两个可比较类型切片的交集。

func JSONParse

func JSONParse[T any](jsonStr string, target *T) error

func MD5

func MD5(params string) string

func ReadExcelColumn

func ReadExcelColumn(filePath string, columnNo int) ([]string, error)

func ReplaceLast

func ReplaceLast(s, old, new string) string

func Reverse

func Reverse[T any](lst []T)

func StrToBool

func StrToBool(str string) bool

func ToErrStatus

func ToErrStatus(key string, args ...string) *err_code.Status

func UUID

func UUID() string

func UrlNameFilter

func UrlNameFilter(old string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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