Versions in this module Expand all Collapse all v6 v6.2.0 Sep 12, 2023 v6.1.0 Feb 27, 2023 Changes in this version + const EzpName + const EzpURL + const HTMLHead v6.0.0 Feb 23, 2023 Changes in this version + const AllID + const AuthBasic + const AuthDigest + const AuthNone + const AuthPlain + const BodyTypeFile + const BodyTypeForm + const BodyTypeHTML + const BodyTypeJSON + const BodyTypeText + const BodyTypeXML + const DefID + const DirCreatePermission + const EncodingGbk + const FileCreatePermission + const FileSizeMax2Split + const InvalidID + const LocationTypeCbd + const LocationTypeCity + const LocationTypeCommunity + const LocationTypeCountry + const LocationTypeCrossing + const LocationTypeDistrict + const LocationTypeMax + const LocationTypeNumber + const LocationTypePoi + const LocationTypeProvince + const LocationTypeStrCbd + const LocationTypeStrCity + const LocationTypeStrCommunity + const LocationTypeStrCountry + const LocationTypeStrCrossing + const LocationTypeStrDistrict + const LocationTypeStrNumber + const LocationTypeStrPoi + const LocationTypeStrProvince + const LocationTypeStrStreet + const LocationTypeStrTown + const LocationTypeStrUnknown + const LocationTypeStreet + const LocationTypeTown + const LocationTypeUnknown + const LogFlagDate + const LogFlagDateNTime + const LogFlagDateTimeNFile + const LogFlagFile + const LogFlagTime + const MapLaloTypeStrLalo + const MapLaloTypeStrLola + const MapReplyStruMap + const MapReplyStruMapslc + const MapReplyTypeDistance + const MapReplyTypeDistanceUnit + const MapReplyTypeDuration + const MapReplyTypeDurationUnit + const MapReplyTypeKnown + const MapReplyTypeLati + const MapReplyTypeLevel + const MapReplyTypeLocation + const MapReplyTypeLongi + const MapReplyTypeResults + const MapReplyTypeStatus + const MimeTypeFile + const MimeTypeForm + const MimeTypeHTML + const MimeTypeJSON + const MimeTypeText + const MimeTypeXML + const PathTypeStrWalk + const UnitTypeHour + const UnitTypeKm + const UnitTypeM + const UnitTypeMin + const UnitTypeSec + const UnitTypeStrHour + const UnitTypeStrKm + const UnitTypeStrM + const UnitTypeStrMin + const UnitTypeStrSec + var AuthInsecureTLS bool + var ChoiceNotification = "Your choice is: " + var Debugging bool + var ErrAbort = errors.New("abort") + var ErrAccess = errors.New("access failure") + var ErrInExistence = errors.New("in existence") + var ErrIncomplete = errors.New("incomplete results") + var ErrInvalidInput = errors.New("invalid input") + var ErrNoValidResults = errors.New("no valid results") + var ErrOutOfBound = errors.New("out of bound") + var Verbose = 0 + func AddLanguage(language, translations string) + func CSVRead(file string) (ret [][]string, err error) + func CSVReadWtEnc(file, encodingStr string) (ret [][]string, err error) + func CSVWrite(file string, data [][]string) (err error) + func CSVWriteNoCreate(file string, data [][]string) error + func CSVWriteWtEnc(file, encodingStr string, data [][]string) (err error) + func CSVWriteWtEncNoCreate(file, encodingStr string, data [][]string) (err error) + func ChkCfmNPrompt(noti, exception string) bool + func ChooseInts(arr [][]string, notif string) (id int) + func ChooseMaps(choices []map[string]string, sep string, indI ...string) int + func ChooseStrings(choices []string) (int, string) + func ChooseStringsWtIDs(fL func() int, fI func(int) int, fV func(int) string, notif string) (res int) + func DiffDate(dateO, dateN string) (diff int, err error) + func EscapeStr4Map(str string) string + func FileAppend(file string, bytes []byte) (err error) + func FileDel(fn string) error + func FileReadByPiece(file string, readSz func(indx uint32, inf fs.FileInfo, done uint32) uint32, ...) (err error) + func FileReaderByPiece(rdr io.ReadCloser, name string, ...) (err error) + func FileType(fn string) string + func FileWrite(file string, bytes []byte) error + func FileWriteNoCreate(file string, bytes []byte) error + func FindStrMap(obj interface{}, key string) (interface{}, bool) + func FormatMimeType(bodyType string) string + func GetCaller(skip int) string + func GetCallerLog() string + func GetCfgDir(vendor, module string) string + func GetDate(info string) string + func GetLanguageStr(id string) (string, error) + func HTTPGetBody(resp *http.Response, magic []byte) (bodyType string, bodyBytes []byte, statusCode int, err error) + func HTTPParseBody(resp *http.Response, fileName string, strucOut interface{}, magic []byte) (recognized, bodyType string, bodyBytes []byte, statusCode int, err error) + func HTTPSend(method, url, bodyType string, bodyReq io.Reader) (*http.Response, error) + func HTTPSendAuth(method, url, bodyType string, authInfo AuthInfo, bodyReq io.Reader) (*http.Response, error) + func HTTPSendAuthNHdr(method, url, bodyType string, authInfo AuthInfo, bodyReq io.Reader, ...) (*http.Response, error) + func HTTPSendAuthNHdrNFile(method, url string, authInfo AuthInfo, fType, fName string, ...) (*http.Response, error) + func HTTPSendHdr(method, url, bodyType string, bodyReq io.Reader, hdrs map[string]string) (*http.Response, error) + func InitLanguages() + func InitLogger(out io.Writer) error + func ListEnc() (ret []string) + func ListLanguages(fun func(name, id string)) + func LoadLanguage(lang string) (string, error) + func Log(out ...any) + func LogFatal(out ...any) + func LogPrint(out ...any) + func LogPrintWtTime(out ...any) + func LogWtTime(out ...any) + func MakeDb() (*Db, Cfg, error) + func MakeDbWtCfgFile(path, file string) (*Db, Cfg, error) + func ParseMimeType(v string) string + func PromptInt(pi string) (res int, err error) + func PromptIntStr(pi string, ps string) (i int, s string) + func PromptPwd(ps string) string + func PromptStr(ps string) string + func RangeStrMap(obj interface{}, fun func(k string, v interface{}) bool) bool + func SQLRows2Strings(rows *sql.Rows) (res [][]string, err error) + func SetLogFlags(f int) + func SetLogFunc(f func(...any)) + func ShowArrln(arr []string) + func ShowByteln(ps []byte) + func ShowSthln(sth any) + func ShowStr(ps ...any) + func ShowStrln(ps ...any) + func ShowWtFmt(fs string, sth ...any) + func TranDate(date string) string + func TranSize(b int64, precision int, space bool) string + func XMLRead(file string, data interface{}) error + func XMLReadDefault(path, file string, cfg interface{}) (pathFound string, err error) + func XMLReader(rdr io.ReadCloser, data interface{}) error + func XMLWrite(file string, data interface{}, indent string) error + func XMLWriteDefault(module string, data interface{}, indent string) (pathFound string, err error) + func XMLWriteNoCreate(file string, data interface{}, indent string) error + func XMLWriter(wrt io.WriteCloser, data interface{}, indent string) error + func Zip(files []string, baseDir, zpName string) (ret []error) + func ZipWtReaderWriter(getRd func() (string, io.ReadCloser), wr io.WriteCloser) (ret []error) + func ZipWtWriter(files []string, baseDir string, wr io.WriteCloser) (ret []error) + type AuthInfo struct + Pass string + Type int + User string + type Cfg struct + Cmt string + Db CfgDb + Map []CfgMap + Root xml.Name + Text string + type CfgDb struct + Cmt string + Db string + IP string + Pas string + TblDef string + Tex string + Usr string + type CfgMap struct + Cmt string + Key string + KeyName string + Lalo string + Locate struct{ ... } + Md5Key string + Md5Pref string + Name string + PathDst string + PathOri string + Paths []struct{ ... } + Separator string + Static []CfgMapStatic + Text string + TimeStamp string + Types CfgMapTypes + func (cfg CfgMap) Addr2Location(addr string, ...) ([]LocationInfo, []byte, error) + func (cfg CfgMap) CalcRouteWalk(loc [2]LocationInfo, ...) ([]PathInfo, []byte, error) + func (cfg CfgMap) CanParseAddr() bool + func (cfg CfgMap) CanRouteWalk() bool + func (cfg CfgMap) CanStaticMap(quan int) bool + func (cfg CfgMap) StaticMap2File(file []string, loc []LocationInfo, ...) (ret error) + type CfgMapParams struct + Cmt string + Max string + Min string + Name string + Text string + type CfgMapReply struct + Cmt string + Name string + Reply []CfgMapReply + Stru string + Text string + Type string + type CfgMapStatic struct + Cmt string + Labels struct{ ... } + Max int + Name string + Param []CfgMapParams + Text string + URLHost string + URLPath string + func (cfg CfgMapStatic) CanStaticMap(quan int) bool + func (cfg CfgMapStatic) StaticMap2File(cfgM CfgMap, file string, loc []LocationInfo, ...) ([]byte, error) + type CfgMapTypes struct + Cmt string + Level []struct{ ... } + Text string + Unit []struct{ ... } + type Db struct + func MakeDbWtCfgs(user, pass, ip, database, tblDef string) (*Db, error) + func (db *Db) SetFldDef(id, str string) + func (db Db) AddPair(table string, id int, str string) (res int, err error) + func (db Db) AddPairNoID(table string, str string) (int, error) + func (db Db) AddWtParams(table string, fields []string, values []string, yes2all bool) (int, error) + func (db Db) AddWtParamsUniq(table string, fields []string, values []string, yes2all bool) (int, error) + func (db Db) AppUpgrade(table, prefix, ver string, server *chan string, ch chan bool) + func (db Db) Authenticate(table, username, password string) error + func (db Db) ChoosePair(table string, allAllowed bool) (int, error) + func (db Db) ChoosePairOrAdd(table string, allAllowed, uniq bool) (int, error) + func (db Db) DeleteWtID(table, id string) error + func (db Db) DeleteWtParams(table, where string, yes2all bool) error + func (db Db) Describe(table string) ([][]string, []string, error) + func (db Db) GetFldID() string + func (db Db) GetFldStr() string + func (db Db) GetMaxID(table string) (int, error) + func (db Db) GetPair(table, id, from, to string) (string, error) + func (db Db) GetPairID(table string, str string) (int, error) + func (db Db) GetPairIDFromInt(table string, val int) (int, error) + func (db Db) GetPairInt(table string, id string) (int, error) + func (db Db) GetPairStr(table string, id string) (string, error) + func (db Db) GetPairStrFromInt(table string, id int) (string, error) + func (db Db) GetSortedPairsIntStr(table string) (ps *Pairs[int, string], err error) + func (db Db) GetTblDef() string + func (db Db) Locate(table string, str string) (id int, err error) + func (db Db) Search(table string, cri string, sel []string, more string) ([][]string, error) + func (db Db) ShrinkIDs(table string, fun func(b4, aft string)) error + func (db Db) UpdatePairID(table string, idOld, idNew string) error + func (db Db) UpdatePairWtParams(table string, id, str string) error + func (db Db) UpdateWtParams(table, cri string, fields, values []string, neglectEmpty, yes2all bool) error + type LocationInfo struct + Label string + Latitude float32 + Longitude float32 + Type int + TypeStr string + func (loc *LocationInfo) Parse(in interface{}, separator, order string) bool + func (loc *LocationInfo) ParseLaLo(in interface{}, lalo string) bool + func (loc *LocationInfo) ParseLevel(types *CfgMapTypes, v any) + func (loc *LocationInfo) SetLabel(lbl any) bool + func (loc LocationInfo) String(separator, order string) string + type Pairs struct + func ReorderParams4Map(pi Pairs[string, string]) (po Pairs[string, string], ret string) + func (ps *Pairs[K, V]) Add(key K, val V) + func (ps *Pairs[K, V]) AddNSort(key K, val V) + func (ps *Pairs[K, V]) FindKey(s K) (ret V, err error) + func (ps *Pairs[K, V]) FindVal(s V) (ret K, err error) + func (ps *Pairs[K, V]) Get(index int) (rK K, rV V, err error) + func (ps *Pairs[K, V]) GetNMove() (rK K, rV V, err error) + func (ps *Pairs[K, V]) Rewind() + func (ps *Pairs[K, V]) Set(index int, key K, val V) error + func (ps *Pairs[K, V]) SetPrev(key K, val V) error + func (ps *Pairs[K, V]) Sort() + func (ps Pairs[K, V]) IsSorted() bool + func (ps Pairs[K, V]) Len() int + type PathInfo struct + Distance float32 + Duration float32 + UnitDistance float32 + UnitDuration float32 + func (path *PathInfo) ParseFlt(v interface{}) (ret32 float32) + func (path *PathInfo) ParseUnit(types CfgMapTypes, v interface{}) (ret float32) + func (path PathInfo) Normalize(val, unit float32) (ret float32) Other modules containing this package gitee.com/bon-ami/eztools gitee.com/bon-ami/eztools/v2 gitee.com/bon-ami/eztools/v3 gitee.com/bon-ami/eztools/v4 gitee.com/bon-ami/eztools/v5