Documentation ¶
Index ¶
- Constants
- Variables
- func AesDecrypt(key, test_str string) (string, error)
- func AesEncrypt(key, test_str string) (string, error)
- func Base64Decode(test_str string) (string, error)
- func Base64Encode(test_str string) string
- func DosName(str string) string
- func FileIsExist(filename string) bool
- func GetAllIPAdress() string
- func GetAllMacAdress() string
- func GetCallStack() (level int, stack string, file string, line int)
- func GetCurrentPath() string
- func GetDebugStack() string
- func GetFileBaseName(path string) string
- func GetFileDir(path string) string
- func GetFileExt(path string) string
- func GetFileExtName(path string) string
- func GetFileModTime(filename string) (time.Time, error)
- func GetFileName(path string) string
- func GetFileRealPath(path string) string
- func GetFileSize(filename string) int64
- func GetFloatSize(fBytes float64) string
- func GetFullFileName(filename string) string
- func GetIPAdress() string
- func GetInt64Size(iBytes int64) string
- func GetIntSize(iBytes int) string
- func GetJson(object interface{}) string
- func GetLastYear() time.Time
- func GetMapByBool(mapi map[string]string, name string, default_value bool) bool
- func GetMapByInt(mapi map[string]string, name string, default_value int) int
- func GetMapByString(mapi map[string]string, name, default_value string) string
- func GetNetError(err error) string
- func GetNow() time.Time
- func GetShowKey(key string) string
- func GetShowPassword(password string) string
- func GetStatusCode(resp *http.Response) int
- func GetStringSize(sBytes string) string
- func GetTimeAgo(t time.Time) string
- func GetTimeText(fBytes int) string
- func GetUInt64Size(iBytes uint64) string
- func IIF(b bool, t, f interface{}) interface{}
- func IIFByTime(flag bool, A, B time.Time) time.Time
- func IIFbyInt(flag bool, A, B int) int
- func IIFbyString(flag bool, A, B string) string
- func If(condition bool, trueVal, falseVal interface{}) interface{}
- func IsAddrInUse(err error) bool
- func IsAscii(text_str string) bool
- func IsChinese(str string) bool
- func IsDir(filename string) (bool, error)
- func IsExeFile(path string) (bool, error)
- func IsHanZi(text_str string) bool
- func IsNetClose(err error) bool
- func IsNumber(text_str string) bool
- func LoadFileText(file_name string) (string, error)
- func LoadJson(json_file string, save_object interface{}) error
- func Md5(test_str string) string
- func Mkdir(path string) error
- func ParseTemplateFile(wr io.Writer, tplname string, data interface{}) error
- func ParseTemplates(wr io.Writer, tplname string, data interface{}) error
- func ReadMachineID(size int) []byte
- func Round(val float64, places int) float64
- func RunFileName() string
- func RunPathName() string
- func SQLExecDDL(db_in *sql.DB, run_sql string, ignore bool) (err error)
- func SQLGetValue(db_in *sql.DB, query_sql string, v ...interface{}) (interface{}, error)
- func SQLGetValueByInt(db_in *sql.DB, query_sql string, v ...interface{}) (bool, int, error)
- func SQLGetValueByString(db_in *sql.DB, query_sql string, v ...interface{}) (string, error)
- func SQLGetValueByTime(db_in *sql.DB, query_sql string, v ...interface{}) (time.Time, error)
- func SQLGetValues(db_in *sql.DB, query_sql string, v ...interface{}) ([]interface{}, error)
- func SQLPrepared(db_in *sql.DB, query_sql string, v ...any) ([]*sql.ColumnType, error)
- func SQLQuery(db_in *sql.DB, query_sql string, v ...interface{}) ([][]string, error)
- func SQLQueryPrint(db_in *sql.DB, query_sql string, v ...interface{}) error
- func SQLRowPrintByResult(query *sql.Rows) error
- func SQLRunByInsert(db_in *sql.DB, run_sql string, v ...interface{}) (int64, error)
- func SQLRunByUpdate(db_in *sql.DB, run_sql string, v ...interface{}) (int64, error)
- func SaveJson(json_file string, save_object interface{}) error
- func SetJson(json_text string, save_object interface{}) error
- func SetRunFileName(file string) string
- func StringToTime(data_str string) (time.Time, error)
- func StringToTimeByTemplates(tm, templates string) (time.Time, error)
- func Substr(str string, start, length int) string
- func TxRunByInsert(db_in *sql.Tx, run_sql string, v ...interface{}) (int64, error)
- func TxRunByUpdate(db_in *sql.Tx, run_sql string, v ...interface{}) (int64, error)
- type Glimit
- type ISingleton
- type JsonTime
- type SingletonInitFunc
- type TAESEncrypt
- func (this *TAESEncrypt) Decrypt(ciphertext string) ([]byte, error)
- func (this *TAESEncrypt) Encrypt(strMesg string) ([]byte, error)
- func (this *TAESEncrypt) Init(key_str string)
- func (this *TAESEncrypt) PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func (this *TAESEncrypt) PKCS5UnPadding(ciphertext []byte, blockSize int) []byte
- func (this *TAESEncrypt) ZeroPadding(ciphertext []byte, blockSize int) []byte
- func (this *TAESEncrypt) ZeroUnPadding(ciphertext []byte, blockSize int) []byte
- type TGUID
- type TLruCache
- type TSingleton
- type TSize
- type TStack
- func (stack *TStack) Empty() bool
- func (stack *TStack) Find(value string) bool
- func (stack *TStack) Get(idx int) (value interface{})
- func (stack *TStack) Pop() (err error)
- func (stack *TStack) PopByValue(value string) (err error)
- func (stack *TStack) Print()
- func (stack *TStack) Push(value string)
- func (stack *TStack) Set(idx int, value string) (err error)
- func (stack *TStack) Size() int
- func (stack *TStack) Swap(other *TStack)
- func (stack *TStack) Top() (value string)
- type TUUID
Constants ¶
const (
ObjectGUIDAttribute = "objectGUID"
)
Variables ¶
var DateFormat string = "2006-01-02"
var DateTimeFormat string = "2006-01-02 15:04:05"
var ErrInvalidID = errors.New("无效的ID")
var MyTitle = `
===============================
作者:tea4go
邮箱:lqq1119@sina.com
===============================
`
var TimeFormat string = "15:04:05"
var TimeLocation *time.Location
Functions ¶
func AesDecrypt ¶
func AesEncrypt ¶
func Base64Decode ¶
func Base64Encode ¶
func FileIsExist ¶
func GetAllIPAdress ¶ added in v1.1.3
func GetAllIPAdress() string
func GetAllMacAdress ¶ added in v1.1.3
func GetAllMacAdress() string
func GetDebugStack ¶
func GetDebugStack() string
func GetFileBaseName ¶
Name returns the last element of path without file extension. Example: /var/www/file.js -> file file.js -> file
func GetFileDir ¶
Dir returns all but the last element of path, typically the path's directory. After dropping the final element, Dir calls Clean on the path and trailing slashes are removed. If the `path` is empty, Dir returns ".". If the `path` is ".", Dir treats the path as current working directory. If the `path` consists entirely of separators, Dir returns a single separator. The returned path does not end in a separator unless it is the root directory.
func GetFileExtName ¶
ExtName 类似于函数 Ext,它返回 path 使用的文件扩展名, 但结果不包含符号'.'
func GetFileName ¶
Basename returns the last element of path, which contains file extension. Trailing path separators are removed before extracting the last element. If the path is empty, Base returns ".". If the path consists entirely of separators, Basename returns a single separator. Example: /var/www/file.js -> file.js file.js -> file.js
func GetFileRealPath ¶
RealPath converts the given <path> to its absolute path and checks if the file path exists. If the file does not exist, return an empty string.
func GetFileSize ¶
func GetFloatSize ¶
func GetFullFileName ¶
得到全路径名称,从当前目录,可执行程序目录,PATH目录查文件,如果找不到则返回传入文件名。
func GetIPAdress ¶
func GetIPAdress() string
func GetInt64Size ¶
func GetIntSize ¶
func GetLastYear ¶
func GetMapByString ¶
func GetStatusCode ¶
func GetStringSize ¶
func GetTimeAgo ¶
func GetTimeText ¶
func GetUInt64Size ¶
func IIFbyString ¶
func IsAddrInUse ¶ added in v1.0.3
func IsNetClose ¶ added in v1.0.9
func LoadFileText ¶
func Mkdir ¶
Mkdir creates directories recursively with given <path>. The parameter <path> is suggested to be an absolute path instead of relative one.
func ParseTemplateFile ¶
模版解析(单文件)
func ParseTemplates ¶
模版解析(可带子模板)
func SQLExecDDL ¶
执行DDL语句,Oracle驱动不支持执行多个SQL语句,MySQL可以。需要拆分执行。
func SQLGetValue ¶
func SQLGetValueByInt ¶
func SQLGetValueByString ¶
func SQLGetValueByTime ¶
func SQLGetValues ¶
func SQLPrepared ¶
func SQLRowPrintByResult ¶
func SQLRunByInsert ¶
func SQLRunByUpdate ¶
func SetRunFileName ¶
func StringToTimeByTemplates ¶
func TxRunByInsert ¶
Types ¶
type ISingleton ¶
type ISingleton interface { // Return the encapsulated singleton GetSingleton() (interface{}, error) }
接口,用于访问单一对象
func NewSingleton ¶
func NewSingleton(init SingletonInitFunc) ISingleton
type SingletonInitFunc ¶
type SingletonInitFunc func() (interface{}, error)
type TAESEncrypt ¶
func (*TAESEncrypt) Init ¶
func (this *TAESEncrypt) Init(key_str string)
func (*TAESEncrypt) PKCS5Padding ¶
func (this *TAESEncrypt) PKCS5Padding(ciphertext []byte, blockSize int) []byte
func (*TAESEncrypt) PKCS5UnPadding ¶
func (this *TAESEncrypt) PKCS5UnPadding(ciphertext []byte, blockSize int) []byte
func (*TAESEncrypt) ZeroPadding ¶
func (this *TAESEncrypt) ZeroPadding(ciphertext []byte, blockSize int) []byte
func (*TAESEncrypt) ZeroUnPadding ¶
func (this *TAESEncrypt) ZeroUnPadding(ciphertext []byte, blockSize int) []byte
type TGUID ¶
GUID represents a GUID/UUID. It has the same structure as golang.org/x/sys/windows.GUID so that it can be used with functions expecting that type. Reference: https://github.com/Microsoft/go-winio/blob/v0.4.14/pkg/guid/guid.go
func GUIDFromBytes ¶
FromWindowsArray constructs a GUID from a Windows encoding array of bytes.
func GUIDFromString ¶
FromString parses a string containing a GUID and returns the GUID. The only format currently supported is the `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` format.
func GUIDFromWindowsArray ¶
FromWindowsArray constructs a GUID from a Windows encoding array of bytes.
func (TGUID) OctetString ¶
OctetString parses a GUID to octet string in Windows encoding. Format supported for AD(ObjectGUID Attribute) search is `\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx\xx`
func (TGUID) ToWindowsArray ¶
ToWindowsArray returns an array of 16 bytes representing the GUID in Windows encoding.
type TLruCache ¶
type TLruCache struct {
// contains filtered or unexported fields
}
func NewLruCache ¶
type TSingleton ¶
func (*TSingleton) GetSingleton ¶
func (s *TSingleton) GetSingleton() (interface{}, error)
type TStack ¶
type TStack struct {
Element []string
}
func (*TStack) PopByValue ¶
返回下一个元素,并从Stack移除元素
type TUUID ¶
type TUUID [rawLen]byte
保证每秒/每个主机/进程有16,777,216(24位)唯一ID - 4字节秒数, - 3字节机器标识符, - 2字节进程ID, - 3字节计数器,以随机值开头。