Documentation
¶
Index ¶
- Constants
- Variables
- 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, ok bool)
- func FileWrite(file string, bytes []byte) error
- func FileWriteNoCreate(file string, bytes []byte) error
- func FindStrMap(obj interface{}, key string) (interface{}, bool)
- func GetDate(info string) string
- func InitLogger(out *os.File) error
- func ListEnc() (ret []string)
- func Log(out ...interface{})
- func LogErr(err error)
- func LogErrFatal(err error)
- func LogErrPrint(err error)
- func LogErrPrintWtInfo(info string, err error)
- func LogErrWtInfo(info string, err error)
- func LogFatal(out ...interface{})
- func LogPrint(out ...interface{})
- func LogPrintWtTime(out ...interface{})
- func LogWtTime(out ...interface{})
- func MakeDbs() (*Dbs, CfgEZtools, error)
- func MakeDbsWtCfgFile(path, file string) (*Dbs, CfgEZtools, error)
- 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 RestGet(url string, authInfo AuthInfo, bodyReq io.Reader) (body interface{}, errNo int, err error)
- func RestGetOrPostSaveFile(method, url string, authInfo AuthInfo, magic []byte, file string) (errNo int, err error)
- func RestGetOrPostWtMagic(method, url string, authInfo AuthInfo, bodyReq io.Reader, magic []byte) (body interface{}, errNo int, err error)
- func RestGetOrPostWtMagicNFileNHdr(method, url string, authInfo AuthInfo, magic []byte, fType, fName string, ...) (body interface{}, errNo int, err error)
- func RestGetWtMagic(url string, authInfo AuthInfo, bodyReq io.Reader, magic []byte) (body interface{}, errNo int, err error)
- func RestPostWtMagic(url string, authInfo AuthInfo, bodyReq io.Reader, magic []byte) (body interface{}, errNo int, err error)
- func ShowArrln(arr []string)
- func ShowByteln(ps []byte)
- func ShowSthln(sth interface{})
- func ShowStr(ps ...interface{})
- func ShowStrln(ps ...interface{})
- func ShowWtFmt(fs string, sth ...interface{})
- func SqlRows2Strings(rows *sql.Rows) (res [][]string, err error)
- 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 XMLWrite(file string, data interface{}, indent string) error
- func XMLWriteNoCreate(file string, data interface{}, indent string) error
- type AuthInfo
- type CfgEZtools
- type CfgEZtoolsDb
- type CfgEZtoolsMap
- type Dbs
- func (db Dbs) AddPair(table string, id int, str string) (res int, err error)
- func (db Dbs) AddPairNoID(table string, str string) (int, error)
- func (db Dbs) AddWtParams(table string, fields []string, values []string, yes2all bool) (int, error)
- func (db Dbs) AddWtParamsUniq(table string, fields []string, values []string, yes2all bool) (int, error)
- func (db Dbs) AppUpgrade(table, prefix, ver string, server *chan string, ch chan bool)
- func (db Dbs) Authenticate(table, username, password string) error
- func (db Dbs) ChoosePair(table string, allAllowed bool) (int, error)
- func (db Dbs) ChoosePairOrAdd(table string, allAllowed, uniq bool) (int, error)
- func (db Dbs) DeleteWtID(table, id string) error
- func (db Dbs) DeleteWtParams(table, where string, yes2all bool) error
- func (db Dbs) Describe(table string) ([][]string, []string, error)
- func (db Dbs) GetFldID() string
- func (db Dbs) GetFldStr() string
- func (db Dbs) GetPair(table, id, from, to string) (string, error)
- func (db Dbs) GetPairID(table string, str string) (int, error)
- func (db Dbs) GetPairIDFromInt(table string, val int) (int, error)
- func (db Dbs) GetPairInt(table string, id string) (int, error)
- func (db Dbs) GetPairStr(table string, id string) (string, error)
- func (db Dbs) GetPairStrFromInt(table string, id int) (string, error)
- func (db Dbs) GetSortedPairsIntStr(table string) (ps *PairsIS, err error)
- func (db Dbs) GetTblDef() string
- func (db Dbs) Locate(table string, str string) (id int, err error)
- func (db Dbs) Search(table string, cri string, sel []string, more string) ([][]string, error)
- func (db Dbs) SetFldDef(id, str string)
- func (db Dbs) UpdatePairID(table string, idOld, idNew string) error
- func (db Dbs) UpdatePairWtParams(table string, id, str string) error
- func (db Dbs) UpdateWtParams(table, cri string, fields, values []string, neglectEmpty, yes2all bool) error
- type LocationInfos
- type PairsFF
- type PairsII
- type PairsIS
- func (ps *PairsIS) Add(id int, val string)
- func (ps PairsIS) FindStr(s string) (int, error)
- func (ps PairsIS) Get(index int) (int, string, error)
- func (ps *PairsIS) GetNMove() (int, string, error)
- func (ps PairsIS) Len() int
- func (ps *PairsIS) Rewind()
- func (ps *PairsIS) Set(index, id int, val string) error
- func (ps *PairsIS) Sort()
- type PairsSS
- func (ps *PairsSS) Add(id, val string)
- func (ps PairsSS) FindId(s string) (string, error)
- func (ps PairsSS) Get(index int) (string, string, error)
- func (ps *PairsSS) GetNMove() (string, string, error)
- func (ps PairsSS) Len() int
- func (ps *PairsSS) Rewind()
- func (ps *PairsSS) Set(index int, id, val string) error
- func (ps *PairsSS) SetPrev(id, val string) error
- type PathInfos
Constants ¶
const ( // DefID is the default ID DefID = 0 // AllID stands for all items, which itself is out of valid ID scope AllID = DefID - 1 // InvalidID better to be negative to be different from a normal ID // it is used as indexes into slices, too InvalidID = DefID - 2 //pairs defined some related )
const ( LOCATION_TYPE_UNKNOWN = iota // areas from larger to smaller LOCATION_TYPE_COUNTRY LOCATION_TYPE_PROVINCE LOCATION_TYPE_CITY LOCATION_TYPE_DISTRICT LOCATION_TYPE_TOWN LOCATION_TYPE_STREET // areas below should be small enough to calculate direction LOCATION_TYPE_CBD LOCATION_TYPE_COMMUNITY LOCATION_TYPE_CROSSING LOCATION_TYPE_POI LOCATION_TYPE_NUMBER LOCATION_TYPE_MAX LOCATION_TYPE_STR_UNKNOWN = "unknown" LOCATION_TYPE_STR_COUNTRY = "country" LOCATION_TYPE_STR_PROVINCE = "province" LOCATION_TYPE_STR_CITY = "city" LOCATION_TYPE_STR_DISTRICT = "district" LOCATION_TYPE_STR_TOWN = "town" LOCATION_TYPE_STR_CBD = "cbd" LOCATION_TYPE_STR_POI = "poi" LOCATION_TYPE_STR_STREET = "street" LOCATION_TYPE_STR_CROSSING = "crossing" LOCATION_TYPE_STR_NUMBER = "number" LOCATION_TYPE_STR_COMMUNITY = "community" MAP_REPLY_TYPE_STATUS = "status" MAP_REPLY_TYPE_RESULTS = "results" MAP_REPLY_TYPE_LEVEL = "level" MAP_REPLY_TYPE_LOCATION = "location" MAP_REPLY_TYPE_LATI = "lati" MAP_REPLY_TYPE_LONGI = "long" MAP_REPLY_TYPE_DISTANCE = "distance" MAP_REPLY_TYPE_DURATION = "duration" MAP_REPLY_STRU_MAP = "map" MAP_REPLY_STRU_MAPSLC = "slicedmap" PATH_TYPE_STR_WALK = "walk" // MAP_LALO_TYPE_STR_LALO = latitude<separator>longitude MAP_LALO_TYPE_STR_LALO = "lalo" // MAP_LALO_TYPE_STR_LALO = longitude<separator>latitude MAP_LALO_TYPE_STR_LOLA = "lola" )
const ( AUTH_NONE = iota AUTH_PLAIN AUTH_BASIC AUTH_DIGEST METHOD_GET = "GET" METHOD_PUT = "PUT" METHOD_POST = "POST" METHOD_DEL = "DELETE" )
const (
EncodingGbk = "gbk"
)
const FileCreatePermission = 0644
Variables ¶
var ( // ErrNoValidResults stands for no valid results ErrNoValidResults = errors.New("No Valid results") // ErrOutOfBound stands for out of bound ErrOutOfBound = errors.New("Out of bound") // ErrInvalidInput stands for invalid input ErrInvalidInput = errors.New("Invalid input") // ErrInExistence stands for result from input already in existence ErrInExistence = errors.New("In Existence") // ErrAccess stands for access failure, such as privilege, collision ErrAccess = errors.New("Access failure") // ErrAbort stands for abort, such as requesting to exit from UI ErrAbort = errors.New("Abort") // ErrIncomplete stands for incomplete results, that is maybe minor ErrIncomplete = errors.New("Incomplete results") )
var ( // Debugging marks debugging mode Debugging bool // whether more debug procedures // Verbose marse debugging output level Verbose = 0 // ChoiceNotification is printed when user needs to choose from choices ChoiceNotification = "Your choice is: " )
Functions ¶
func CSVReadWtEnc ¶
CSVReadWtEnc reads file into slice of slice of string, with specified encoding
func CSVWriteNoCreate ¶
CSVWriteNoCreate writes data to existing file by a full path (with .csv extension)
func CSVWriteWtEnc ¶ added in v3.1.0
CSVWriteWtEnc writes file with slice of slice of string, with specified encoding
func CSVWriteWtEncNoCreate ¶ added in v3.1.0
CSVWriteWtEncNoCreate writes existing file with slice of slice of string, with specified encoding
func ChkCfmNPrompt ¶
ChkCfmNPrompt checks defaults and return false only when user replied exception program exits when user replied 'q' or 'e' no more confirmations when user replied 'a' or 'c' verbose set when user replied a number, in which case the prompt will show again
All answers taken as lowercase
func ChooseInts ¶
ChooseInts asks user to choose from a slice Parameters. arr[][0]=id. arr[][1]=string
func ChooseMaps ¶
ChooseMaps asks user to choose from a slice of map of string to string parameters: slice.
separator between two piece of information. index(-es) into the map (to be contacted) to be information of each item, or separators between two indexes.
example: (c, ";", "a", "c") with
c index name value 0 a A 0 c C 1 a B 1 c D will print 0: A;C 1: B;D
func ChooseStrings ¶
ChooseStrings asks user to choose from a slice return values: index (InvalidID if not a valid one) and string
func ChooseStringsWtIDs ¶
func ChooseStringsWtIDs(fL func() int, fI func(int) int, fV func(int) string, notif string) (res int)
ChooseStringsWtIDs is for general usage to ask user to choose from a slice or anything parameters.
fL=quantity of elements fI=get index to match user's input fV=get message to show for each index notif=notification string for user
func FileWriteNoCreate ¶ added in v3.1.0
FileWriteNoCreate writes input bytes to existing file
func FindStrMap ¶
FindStrMap find string key in map[string]interface{} obj,
returning the value and true or nil and false.
func ListEnc ¶
func ListEnc() (ret []string)
ListEnc list all valid encoding strings for
CSVReadWtEnc() UTF-8 is default and not listed.
func LogErrPrintWtInfo ¶
LogErrPrintWtInfo logs and prints error with information string
func LogErrWtInfo ¶
LogErrWtInfo logs error with information string
func LogPrintWtTime ¶
func LogPrintWtTime(out ...interface{})
LogPrintWtTime logs and prints a string with time
func MakeDbs ¶
func MakeDbs() (*Dbs, CfgEZtools, error)
MakeDb connects to the database using parameters from eztools.xml root element is named "root", elements include "ip", "db", "user" and "pass"
func MakeDbsWtCfgFile ¶
func MakeDbsWtCfgFile(path, file string) (*Dbs, CfgEZtools, error)
MakeDbWtCfgFile connects to the database using paramters from {path}/{file} Parameters: path defaults to ${HOME} and .
file defaults to "eztools.xml"
func PromptIntStr ¶
PromptIntStr prompts user and gets two inputs Return values. zero values are default
func RangeStrMap ¶
RangeStrMap iterate through map[string]interface{} obj, calling fun for
each element recursively. When fun returns true, it stops. false is returned if no element found.
func RestGet ¶
func RestGet(url string, authInfo AuthInfo, bodyReq io.Reader) (body interface{}, errNo int, err error)
RestGet sends Restful API request and returns the result.
func RestGetOrPostSaveFile ¶
func RestGetOrPostSaveFile(method, url string, authInfo AuthInfo, magic []byte, file string) (errNo int, err error)
RestGetOrPostBodyBytes sends Restful API request as a method and returns the result.
A magic string can be listed to be stripped in the beginning of the result.
func RestGetOrPostWtMagic ¶
func RestGetOrPostWtMagic(method, url string, authInfo AuthInfo, bodyReq io.Reader, magic []byte) (body interface{}, errNo int, err error)
RestGetOrPostWtMagic sends Restful API request as a method and returns the result.
A magic string can be listed to be stripped in the beginning of the result. If magic string is assigned but not found in the result, the result will not be parsed. If failure response received, bodyMap is slice of byte, copying the failure body.
func RestGetOrPostWtMagicNFileNHdr ¶
func RestGetOrPostWtMagicNFileNHdr(method, url string, authInfo AuthInfo, magic []byte, fType, fName string, hdrs map[string]string) (body interface{}, errNo int, err error)
RestGetOrPostWtMagicNFileNHdr sends Restful API request as a method and returns the result.
Use this to specify a file with name and type to be sent as body, and/or extra headers. If something wrong with the file, a request will be sent without it anyway. A magic string can be listed to be stripped in the beginning of the result. If magic string is assigned but not found in the result, the result will not be parsed. If failure response received, bodyMap is slice of byte, copying the failure body.
func RestGetWtMagic ¶
func RestGetWtMagic(url string, authInfo AuthInfo, bodyReq io.Reader, magic []byte) (body interface{}, errNo int, err error)
RestGetWtMagic sends Restful API request as GET and returns the result.
A magic string can be listed to be stripped in the beginning of the result. If magic string is assigned but not found in the result, the result will not be parsed.
func RestPostWtMagic ¶
func RestPostWtMagic(url string, authInfo AuthInfo, bodyReq io.Reader, magic []byte) (body interface{}, errNo int, err error)
RestPostWtMagic sends Restful API request as POST and returns the result.
A magic string can be listed to be stripped in the beginning of the result. If magic string is assigned but not found in the result, the result will not be parsed.
func ShowArrln ¶
func ShowArrln(arr []string)
ShowArrln prints a slice in one line with a line break
func ShowByteln ¶
func ShowByteln(ps []byte)
ShowByteln prints byte slice as string with a line break
func ShowSthln ¶
func ShowSthln(sth interface{})
ShowSthln prints anything with struct names and a line break
func ShowWtFmt ¶
func ShowWtFmt(fs string, sth ...interface{})
ShowWtFmt prints with format string like printf
func SqlRows2Strings ¶
SqlRows2Strings returns arrays from rows
func TranDate ¶
TranDate removes minuses from date string return current date if empty string as param
func TranSize ¶
TranSize shows the number as file size format input params: b=number; precision=how many number to keep lower than point;
space=whether a space is put between number and unit
copied from https://programming.guide/go/formatting-byte-size-to-human-readable-format.html
func XMLReadDefault ¶ added in v3.1.0
XMLReadDefault reads config file into input structure from given path, or given file name (plus .xml) under current dir or home dir returns full file name with path
func XMLWrite ¶
XMLWrite writes file from input structure by a full path (with .xml extension) this reformats the file with indent provided
func XMLWriteNoCreate ¶
XMLWriteNoCreate writes existing file from input structure by a full path (with .xml extension) this reformats the file with indent provided
Types ¶
type CfgEZtools ¶ added in v3.2.0
type CfgEZtools struct { // Root of the XML Root xml.Name `xml:"eztools"` // Cmt = comments Cmt string `xml:",comment"` // Text is not used Text string `xml:",chardata"` Db CfgEZtoolsDb `xml:"db"` Map []CfgEZtoolsMap `xml:"map"` }
CfgEZtools defines the structure of a predefined config xml
type CfgEZtoolsDb ¶ added in v3.2.0
type CfgEZtoolsDb struct { // Cmt = comments Cmt string `xml:",comment"` // StrUSER name of the user element for DB StrUSER string `xml:"user"` // StrPASS name of the password element for DB StrPASS string `xml:"pass"` // StrIP name of the IP element for DB StrIP string `xml:"ip"` // StrDB name of the database element StrDB string `xml:"name"` // TblDef name of the default table for DB TblDef string `xml:"tblDef"` // Text is not used Text string `xml:",chardata"` }
type CfgEZtoolsMap ¶ added in v3.2.0
type CfgEZtoolsMap struct { Cmt string `xml:",comment"` Name string `xml:"name,attr"` Key string `xml:"key,attr"` Separator string `xml:"separator,attr"` PathOri string `xml:"ori,attr"` PathDst string `xml:"dst,attr"` Md5Key string `xml:"md5Key,attr"` Md5Pref string `xml:"md5Pref,attr"` Lalo string `xml:"lalo,attr"` TimeStamp string `xml:"timestamp,attr"` // Text is not used Text string `xml:",chardata"` Locate struct { Cmt string `xml:",comment"` UrlHost string `xml:"urlHost,attr"` UrlPath string `xml:"urlPath,attr"` Addr string `xml:"addr,attr"` Reply []cfgEZtoolsMapReply `xml:"reply"` // Text is not used Text string `xml:",chardata"` } `xml:"locate"` Levels struct { Cmt string `xml:",comment"` // Text is not used Text string `xml:",chardata"` Level []struct { Cmt string `xml:",comment"` Type string `xml:"type,attr"` Text string `xml:",chardata"` } `xml:"level"` } `xml:"levels"` Paths []struct { Cmt string `xml:",comment"` Type string `xml:"type,attr"` UrlHost string `xml:"urlHost,attr"` UrlPath string `xml:"urlPath,attr"` Reply []cfgEZtoolsMapReply `xml:"reply"` // Text is not used Text string `xml:",chardata"` } `xml:"path"` // contains filtered or unexported fields }
func (CfgEZtoolsMap) Addr2Location ¶ added in v3.2.0
func (cfg CfgEZtoolsMap) Addr2Location(addr string) ([]LocationInfos, error)
Addr2Location returns location info from address string
func (CfgEZtoolsMap) CalcRouteWalk ¶ added in v3.2.0
func (cfg CfgEZtoolsMap) CalcRouteWalk(loc [2]LocationInfos) ( []PathInfos, error)
returns location info from address string
type Dbs ¶
func MakeDbsWtCfgs ¶
MakeDbWtCfgs connects to the database using paramters,
and initialize variables with table tblDef
Return value: error = ErrIncomplete when tblDef does not provide
information for variables. use SetFldDef to provide it afterwards.
func (Dbs) AddPairNoID ¶
AddPairNoID adds an item with value, where ID should be auto generated
func (Dbs) AddWtParams ¶
func (db Dbs) AddWtParams(table string, fields []string, values []string, yes2all bool) (int, error)
AddWtParams adds "values" to "fields", no matter whether duplicate records in existence. Parameter yes2all = no confirmation in debug mode. Always no confirmation in non-debug mode.
func (Dbs) AddWtParamsUniq ¶
func (db Dbs) AddWtParamsUniq(table string, fields []string, values []string, yes2all bool) (int, error)
AddWtParamsUniq adds "values" to "fields", if no duplicate records in existence. Parameter yes2all = no confirmation in debug mode. Always no confirmation in non-debug mode.
func (Dbs) AppUpgrade ¶
AppUpgrade checks for updates and applies the update automatically, which will work next time the app is run. Parameters: - table not used yet and is tblDef - Items with following names and **prefix**, in table, are used to check updates
- Url, UrlDev: IP of the update server
- Dir: dir name on the server
- App: app name on the server
- ver: current version
- server: server info returned, if null
- ch: 1st=false, if wrong server URL configured. 2nd=false, if other configurations wrong, or update check fails.
func (Dbs) Authenticate ¶
Authenticate checks whether authenticated. Parameters: table not used yet and is tblDef Return value: nil if true; ErrNoValidResults if no db config for table name
func (Dbs) ChoosePair ¶
ChoosePair asks user to choose from a table by ID - value pairs. Return value: InvalidID and nil, for invalid input
func (Dbs) ChoosePairOrAdd ¶
ChoosePairOrAdd asks user to choose from a table by ID - value pairs,
allowing to add one new.
Return value: InvalidID and nil, for invalid input
func (Dbs) DeleteWtParams ¶
DeleteWtParams deletes items with specified WHERE clause
func (Dbs) Describe ¶
Describe returns all column information e.g., [[id char(50) NO PRI] [ str tinytext YES ]] Return values: all info, column names, error
func (Dbs) GetPair ¶
GetPair gets "to" field whose "from" field equals "id" in "table" When multiple results got, the first one will be taken. return value error = from db.Query;
ErrNoValidResults when no valid results got, and LogErrPrint will be called.
func (Dbs) GetPairID ¶
GetPairID gets ID (int) from value (string) When multiple results got, the first one will be taken.
func (Dbs) GetPairIDFromInt ¶
// GetSortedPairsIntInt returns all sorted PairsII from input table
func (db Dbs) GetSortedPairsIntInt(table string) (pi *PairsII, err error) { pi = new(PairsII) err = db.selectSortedPairs(table, func(id, val interface{}, err error) { defer LogErr(err) if err != nil { return } i, ok := id.(int) if !ok { return } v, ok := val.(int) if !ok { return } pi.Add(i, v) }) return }
GetPairIDFromInt gets ID (int) from value (int) When multiple results got, the first one will be taken.
func (Dbs) GetPairInt ¶
GetPairInt gets value (int) from ID (string)
func (Dbs) GetPairStr ¶
GetPairStr gets value (string) from ID (string)
func (Dbs) GetPairStrFromInt ¶
GetPairStrFromInt gets value (string) from ID (int)
func (Dbs) GetSortedPairsIntStr ¶
GetSortedPairsIntStr returns all sorted PairsIS from input table
func (Dbs) Search ¶
Search gets values of fields "sel" from "table", using "cri" as "WHERE",
with "more" appended to SQL command.
Parameters: more: will not be prefixed with space automatically
func (Dbs) UpdatePairID ¶
UpdatePairID updates ID
func (Dbs) UpdatePairWtParams ¶
UpdatePairWtParams updates value by ID
func (Dbs) UpdateWtParams ¶
func (db Dbs) UpdateWtParams(table, cri string, fields, values []string, neglectEmpty, yes2all bool) error
UpdateWtParams updates "fields" in "table" with "values", using "cri" as "WHERE". Parameter yes2all = no confirmation in debug mode. Always no confirmation in non-debug mode. Return values:
ErrInvalidInput if no fields/values as parameters ErrAbort if user chooese no when yes2all is true ErrNoValidResults if no update command can be constructed other errors from sql
type LocationInfos ¶ added in v3.2.0
type LocationInfos struct { // there may be more members in this struct, // so use member names during instance creation Latitude, Longitude float32 LevelInt int LevelStr string }
func (*LocationInfos) Parse ¶ added in v3.2.0
func (loc *LocationInfos) Parse(in interface{}, separator, order string) bool
func (*LocationInfos) ParseLaLo ¶ added in v3.2.0
func (loc *LocationInfos) ParseLaLo(in interface{}, lalo string) bool
ParseLaLo sets a string or float64 to latitude or longitude
func (*LocationInfos) SetLevel ¶ added in v3.2.0
func (loc *LocationInfos) SetLevel(str string, val int)
func (LocationInfos) String ¶ added in v3.2.0
func (loc LocationInfos) String(separator, order string) string
type PairsFF ¶ added in v3.2.0
type PairsFF struct {
// contains filtered or unexported fields
}
PairsII is a collection of int-int
func (*PairsFF) Add ¶ added in v3.2.0
Add appends values to the collection,
moving cursor to the next
func (*PairsFF) GetNMove ¶ added in v3.2.0
Next moves to the next item in PairsInt and return the values
call Rewind() after Add() to reset to and get the first item
error=ErrOutOfBound when the end met
type PairsII ¶
type PairsII struct {
// contains filtered or unexported fields
}
PairsII is a collection of int-int
func (*PairsII) GetNMove ¶
Next moves to the next item in PairsInt and return the values
call Rewind() after Add() to reset to and get the first item
error=ErrOutOfBound when the end met
type PairsIS ¶
type PairsIS struct {
// contains filtered or unexported fields
}
PairsIS is a collection of int-string
func (PairsIS) FindStr ¶
FindStr find the first ID whose **value** matches input return value: ErrNoValidResults when none found
func (*PairsIS) GetNMove ¶
Next gets the current item in the collection and moves to the next
call Rewind() after Add() to reset to and get the first item
error=ErrOutOfBound when the end met
func (*PairsIS) Rewind ¶
func (ps *PairsIS) Rewind()
Rewind used after Add() to reset and before GetNMove() to the first item
type PairsSS ¶
type PairsSS struct {
// contains filtered or unexported fields
}
PairsSS is a collection of string-string
func (*PairsSS) GetNMove ¶
Next gets the current item in the collection and moves to the next
call Rewind() after Add() to reset to and get the first item
error=ErrOutOfBound when the end met
func (*PairsSS) Rewind ¶
func (ps *PairsSS) Rewind()
Rewind used after Add() to reset and before GetNMove() to the first item