Documentation ¶
Index ¶
- func GetURLNameType(sendURL string) map[string]string
- func LoadConfigFile(configSrc string) (map[string]interface{}, error)
- func SaveConfigFile(configSrc string, configData interface{}) error
- func SetName(name string)
- func SimpleHttpGet(sendURL string, params map[string][]string) ([]byte, error)
- func SimpleHttpPost(sendURL string, params map[string][]string) ([]byte, error)
- type Database
- func (this *Database) Close() error
- func (this *Database) Connect(dbType string, dbDNS string) error
- func (this *Database) Delete(table string, id int64) (int64, error)
- func (this *Database) GetField(table string, fields []string, field string, value string) (*sql.Row, error)
- func (this *Database) GetFieldsToStr(fields []string) string
- func (this *Database) GetID(table string, fields []string, id int) (*sql.Row, error)
- func (this *Database) GetList(table string, fields []string, page int, max int, sort int, desc bool) (map[int]map[string]interface{}, error)
- func (this *Database) GetPageSortStr(page int, max int, sort string, desc bool) string
- func (this *Database) GetResultToList(fields []string, result *sql.Rows) (map[int]map[string]interface{}, error)
- func (this *Database) Insert(table string, fields []string, values []string)
- func (this *Database) Update(table string, setField string, setValue string, id int) (int64, error)
- type FileOperate
- func (this *FileOperate) CopyFile(src string, dest string) (bool, error)
- func (this *FileOperate) CreateDir(src string) error
- func (this *FileOperate) CutFile(src string, newSrc string) error
- func (this *FileOperate) DeleteFile(src string) error
- func (this *FileOperate) GetFileInfo(src string) (os.FileInfo, error)
- func (this *FileOperate) GetFileList(src string) ([]string, error)
- func (this *FileOperate) GetFileListCount(src string) (int, error)
- func (this *FileOperate) GetFileNames(src string) (map[string]string, error)
- func (this *FileOperate) GetFileSha1(src string) (string, error)
- func (this *FileOperate) GetFileSize(src string) int64
- func (this *FileOperate) GetPathSep() string
- func (this *FileOperate) GetTimeDirSrc(src string, appendFileType string) (string, error)
- func (this *FileOperate) IsExist(src string) bool
- func (this *FileOperate) IsFile(src string) bool
- func (this *FileOperate) IsFolder(src string) bool
- func (this *FileOperate) LoadFile(src string) ([]byte, error)
- func (this *FileOperate) WriteFile(src string, content []byte) error
- func (this *FileOperate) WriteFileAppend(src string, content []byte, isForward bool) error
- type IPAddrs
- type Language
- type Log
- func (this *Log) GetNowTime() string
- func (this *Log) NewLog(msg string, err error)
- func (this *Log) SendFile(content string)
- func (this *Log) SendFmtPrintln(msg string)
- func (this *Log) SetIsAppendIP(b bool)
- func (this *Log) SetIsAppendTime(b bool)
- func (this *Log) SetIsForward(b bool)
- func (this *Log) SetIsSendErrorToFile(b bool)
- func (this *Log) SetIsSendErrorToFmt(b bool)
- func (this *Log) SetIsSendMsgToFile(b bool)
- func (this *Log) SetIsSendMsgToFmt(b bool)
- func (this *Log) SetLogDirSrc(logDirSrc string)
- func (this *Log) SetOneFileName(name string)
- func (this *Log) UpdateIP()
- type MatchString
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetURLNameType ¶
Get the file name and type by URL
func LoadConfigFile ¶
Read the configuration file
func SaveConfigFile ¶
Write the configuration file
func SetName ¶
func SetName(name string)
Set name name string - A unique string for all application identifiers
func SimpleHttpGet ¶
Gets the URL data get mode
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database operation module
func (*Database) GetField ¶
func (this *Database) GetField(table string, fields []string, field string, value string) (*sql.Row, error)
Gets the specified field
func (*Database) GetFieldsToStr ¶
Obtains a field string based on the number of fields.
func (*Database) GetList ¶
func (this *Database) GetList(table string, fields []string, page int, max int, sort int, desc bool) (map[int]map[string]interface{}, error)
get the list
func (*Database) GetPageSortStr ¶
Get the sql pagination combo section.
func (*Database) GetResultToList ¶
func (this *Database) GetResultToList(fields []string, result *sql.Rows) (map[int]map[string]interface{}, error)
Obtain a list of data according to the field.
type FileOperate ¶
type FileOperate struct { }
func (*FileOperate) CopyFile ¶
func (this *FileOperate) CopyFile(src string, dest string) (bool, error)
Copy file
func (*FileOperate) CreateDir ¶
func (this *FileOperate) CreateDir(src string) error
Create a folder
func (*FileOperate) CutFile ¶
func (this *FileOperate) CutFile(src string, newSrc string) error
Modify the file name Can be used to cut files.
func (*FileOperate) GetFileInfo ¶
func (this *FileOperate) GetFileInfo(src string) (os.FileInfo, error)
Get file information
func (*FileOperate) GetFileList ¶
func (this *FileOperate) GetFileList(src string) ([]string, error)
Gets a list of files under the folder
func (*FileOperate) GetFileListCount ¶
func (this *FileOperate) GetFileListCount(src string) (int, error)
Gets the number of files in the folder
func (*FileOperate) GetFileNames ¶
func (this *FileOperate) GetFileNames(src string) (map[string]string, error)
Gets the file name and type
func (*FileOperate) GetFileSha1 ¶
func (this *FileOperate) GetFileSha1(src string) (string, error)
Calculates the file sha1 value
func (*FileOperate) GetFileSize ¶
func (this *FileOperate) GetFileSize(src string) int64
Get the file size
func (*FileOperate) GetPathSep ¶
func (this *FileOperate) GetPathSep() string
Gets the system path separator
func (*FileOperate) GetTimeDirSrc ¶
func (this *FileOperate) GetTimeDirSrc(src string, appendFileType string) (string, error)
Gets the directory path for the time build eg : Return and create the path ,"[src]/201611/" eg : Return and create the path ,"[src]/201611/2016110102-03[appendFileType]"
func (*FileOperate) IsExist ¶
func (this *FileOperate) IsExist(src string) bool
Determine whether the file exists
func (*FileOperate) IsFile ¶
func (this *FileOperate) IsFile(src string) bool
Determine whether the file
func (*FileOperate) IsFolder ¶
func (this *FileOperate) IsFolder(src string) bool
To determine whether the folder
func (*FileOperate) LoadFile ¶
func (this *FileOperate) LoadFile(src string) ([]byte, error)
Load file
func (*FileOperate) WriteFile ¶
func (this *FileOperate) WriteFile(src string, content []byte) error
Write file If the file does not exist, it is created.
func (*FileOperate) WriteFileAppend ¶
func (this *FileOperate) WriteFileAppend(src string, content []byte, isForward bool) error
Append data to a file
type IPAddrs ¶
type IPAddrs struct {
// contains filtered or unexported fields
}
IP address structure
func (*IPAddrs) GetExternal ¶
Obtain an IP address from the network
type Language ¶
type Language struct {
// contains filtered or unexported fields
}
Language configuration processor
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
log struct You need to set the related configuration. IP address if the output is set, otherwise you can leave empty.
func (*Log) SetIsSendErrorToFile ¶
Set is send error to file
func (*Log) SetIsSendErrorToFmt ¶
Set is send error to fmt
func (*Log) SetIsSendMsgToFile ¶
Set is send error to file
type MatchString ¶
type MatchString struct { }
Authentication and query modules
func (*MatchString) CheckPassword ¶
func (this *MatchString) CheckPassword(str string) bool
Verify the 6-20 digit password
func (*MatchString) CheckUsername ¶
func (this *MatchString) CheckUsername(str string) bool
Verify the 4-16-digit user name
func (*MatchString) GetRandStr ¶
func (this *MatchString) GetRandStr(n int) string
Get a random number n - range
func (*MatchString) GetSha1 ¶
func (this *MatchString) GetSha1(content string) string
Gets the string sha1 value