Documentation ¶
Index ¶
- Variables
- type BufferPool
- type ByteHelper
- type ConsoleColorHelper
- func (this *ConsoleColorHelper) Blue() string
- func (this *ConsoleColorHelper) BlueBackground() string
- func (this *ConsoleColorHelper) Clear() string
- func (this *ConsoleColorHelper) Cyan() string
- func (this *ConsoleColorHelper) CyanBackground() string
- func (this *ConsoleColorHelper) GrayBackground() string
- func (this *ConsoleColorHelper) Green() string
- func (this *ConsoleColorHelper) GreenBackground() string
- func (this *ConsoleColorHelper) Magenta() string
- func (this *ConsoleColorHelper) MagentaBackground() string
- func (this *ConsoleColorHelper) Red() string
- func (this *ConsoleColorHelper) RedBackground() string
- func (this *ConsoleColorHelper) White() string
- func (this *ConsoleColorHelper) WhiteBackground() string
- func (this *ConsoleColorHelper) Yello() string
- func (this *ConsoleColorHelper) YelloBackground() string
- type ExecHelper
- type FileHelper
- type HttpHelper
- func (this *HttpHelper) Do(r *http.Request) (*http.Response, error)
- func (this *HttpHelper) Get(addr string) ([]byte, error)
- func (this *HttpHelper) NewRequest(method, addr string, body io.Reader) (*http.Request, error)
- func (this *HttpHelper) Post(addr string, body io.Reader) ([]byte, error)
- func (this *HttpHelper) PostForm(addr string, data url.Values) ([]byte, error)
- func (this *HttpHelper) RemoteAddr(req *http.Request) string
- type PathHelper
- func (this *PathHelper) Abs(filePath string) (string, error)
- func (this *PathHelper) Create(dir string, perm os.FileMode) error
- func (this *PathHelper) CreateDir(filePath string, perm os.FileMode) error
- func (this *PathHelper) Dir(filePath string) (string, error)
- func (this *PathHelper) ExecPath() string
- func (this *PathHelper) FileName(filePath string) (string, error)
- func (this *PathHelper) IsExist(path string) (bool, error)
- func (this *PathHelper) Split(filePath string) []string
- func (this *PathHelper) WorkDir() string
- func (this *PathHelper) WorkName() string
- type RandHelper
- type StringHelper
- type StructMapHelper
- func (this *StructMapHelper) FromMap(obj interface{}, m map[string]interface{}, tag string)
- func (this *StructMapHelper) FromMapString(obj interface{}, m map[string]string, tag string)
- func (this *StructMapHelper) MapString() string
- func (this *StructMapHelper) ToMap(obj interface{}, tag string) map[string]interface{}
- func (this *StructMapHelper) ToMapString(obj interface{}, tag string) map[string]string
- type TimeHelper
Constants ¶
This section is empty.
Variables ¶
var ConsoleColor = NewConsoleColorHelper()
var Exec = NewExecHelper()
var File = NewFileHelper()
var Http = NewHttpHelper(90, false)
var Path = NewPathHelper()
var Rand = NewRandHelper()
var String = NewStringHelper()
var Time = NewTimeHelper()
Functions ¶
This section is empty.
Types ¶
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
BufferPool implements a pool of bytes.Buffers in the form of a bounded channel.
func NewBufferPool ¶
func NewBufferPool(size int) (bp *BufferPool)
NewBufferPool creates a new BufferPool bounded to the given size.
func (*BufferPool) Get ¶
func (this *BufferPool) Get() (buffer *bytes.Buffer)
Get gets a Buffer from the BufferPool, or creates a new one if none are available in the pool.
func (*BufferPool) Set ¶
func (this *BufferPool) Set(buffer *bytes.Buffer)
Set returns the given Buffer to the BufferPool.
type ByteHelper ¶
type ByteHelper struct{}
func NewByteHelper ¶
func NewByteHelper() *ByteHelper
func (*ByteHelper) Bin2Byte ¶
func (this *ByteHelper) Bin2Byte(bin []byte) (buf []byte)
func (*ByteHelper) Byte2Bin ¶
func (this *ByteHelper) Byte2Bin(buf []byte) (bin []byte)
func (*ByteHelper) Byte2Hex ¶
func (this *ByteHelper) Byte2Hex(buf []byte) (hex []byte)
func (*ByteHelper) Hex2Byte ¶
func (this *ByteHelper) Hex2Byte(hex []byte) (buf []byte)
type ConsoleColorHelper ¶
type ConsoleColorHelper struct{}
func NewConsoleColorHelper ¶
func NewConsoleColorHelper() *ConsoleColorHelper
func (*ConsoleColorHelper) Blue ¶
func (this *ConsoleColorHelper) Blue() string
func (*ConsoleColorHelper) BlueBackground ¶
func (this *ConsoleColorHelper) BlueBackground() string
func (*ConsoleColorHelper) Clear ¶
func (this *ConsoleColorHelper) Clear() string
func (*ConsoleColorHelper) Cyan ¶
func (this *ConsoleColorHelper) Cyan() string
func (*ConsoleColorHelper) CyanBackground ¶
func (this *ConsoleColorHelper) CyanBackground() string
func (*ConsoleColorHelper) GrayBackground ¶
func (this *ConsoleColorHelper) GrayBackground() string
\033[90;47m
func (*ConsoleColorHelper) Green ¶
func (this *ConsoleColorHelper) Green() string
func (*ConsoleColorHelper) GreenBackground ¶
func (this *ConsoleColorHelper) GreenBackground() string
func (*ConsoleColorHelper) Magenta ¶
func (this *ConsoleColorHelper) Magenta() string
func (*ConsoleColorHelper) MagentaBackground ¶
func (this *ConsoleColorHelper) MagentaBackground() string
func (*ConsoleColorHelper) Red ¶
func (this *ConsoleColorHelper) Red() string
func (*ConsoleColorHelper) RedBackground ¶
func (this *ConsoleColorHelper) RedBackground() string
func (*ConsoleColorHelper) White ¶
func (this *ConsoleColorHelper) White() string
func (*ConsoleColorHelper) WhiteBackground ¶
func (this *ConsoleColorHelper) WhiteBackground() string
func (*ConsoleColorHelper) Yello ¶
func (this *ConsoleColorHelper) Yello() string
func (*ConsoleColorHelper) YelloBackground ¶
func (this *ConsoleColorHelper) YelloBackground() string
type FileHelper ¶
type FileHelper struct{}
func NewFileHelper ¶
func NewFileHelper() *FileHelper
func (*FileHelper) CopyFile ¶
func (this *FileHelper) CopyFile(src, dst string) (int64, error)
Copy copies from src to dst until either EOF is reached on src or an error occurs. It returns the number of bytes copied and the first error encountered while copying, if any.
A successful Copy returns err == nil, not err == EOF. Because Copy is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported.
If src implements the WriterTo interface, the copy is implemented by calling src.WriteTo(dst). Otherwise, if dst implements the ReaderFrom interface, the copy is implemented by calling dst.ReadFrom(src).
func (*FileHelper) GZipFile ¶
func (this *FileHelper) GZipFile(src, dst string) error
Use gzip to compress src to dst until either EOF is reached or an error occurs.
type HttpHelper ¶
type HttpHelper struct { UserAgent string // contains filtered or unexported fields }
func NewHttpHelper ¶
func NewHttpHelper(timeout int, insecure bool) *HttpHelper
func (*HttpHelper) NewRequest ¶
func (*HttpHelper) RemoteAddr ¶
func (this *HttpHelper) RemoteAddr(req *http.Request) string
type PathHelper ¶
type PathHelper struct{}
func NewPathHelper ¶
func NewPathHelper() *PathHelper
func (*PathHelper) CreateDir ¶
func (this *PathHelper) CreateDir(filePath string, perm os.FileMode) error
func (*PathHelper) ExecPath ¶
func (this *PathHelper) ExecPath() string
func (*PathHelper) Split ¶
func (this *PathHelper) Split(filePath string) []string
func (*PathHelper) WorkDir ¶
func (this *PathHelper) WorkDir() string
WorkDir returns absolute path of work directory.
func (*PathHelper) WorkName ¶
func (this *PathHelper) WorkName() string
type RandHelper ¶
type RandHelper struct{}
func NewRandHelper ¶
func NewRandHelper() *RandHelper
func (*RandHelper) Num ¶
func (this *RandHelper) Num(length int) int64
type StringHelper ¶
type StringHelper struct{}
func NewStringHelper ¶
func NewStringHelper() *StringHelper
func (*StringHelper) Empty ¶
func (this *StringHelper) Empty() string
func (*StringHelper) IsEmpty ¶
func (this *StringHelper) IsEmpty(str string) bool
func (*StringHelper) IsEqual ¶
func (this *StringHelper) IsEqual(str, equal string) bool
func (*StringHelper) IsNotEmpty ¶
func (this *StringHelper) IsNotEmpty(str string) bool
func (*StringHelper) IsNotEqual ¶
func (this *StringHelper) IsNotEqual(str, equal string) bool
type StructMapHelper ¶
type StructMapHelper struct { Name string `map:"Name"` // example Value string `map:"Value"` // example }
func NewStructMapHelper ¶
func NewStructMapHelper() *StructMapHelper
func (*StructMapHelper) FromMap ¶
func (this *StructMapHelper) FromMap(obj interface{}, m map[string]interface{}, tag string)
func (*StructMapHelper) FromMapString ¶
func (this *StructMapHelper) FromMapString(obj interface{}, m map[string]string, tag string)
func (*StructMapHelper) MapString ¶
func (this *StructMapHelper) MapString() string
func (*StructMapHelper) ToMap ¶
func (this *StructMapHelper) ToMap(obj interface{}, tag string) map[string]interface{}
func (*StructMapHelper) ToMapString ¶
func (this *StructMapHelper) ToMapString(obj interface{}, tag string) map[string]string
type TimeHelper ¶
type TimeHelper struct{}
func NewTimeHelper ¶
func NewTimeHelper() *TimeHelper
func (*TimeHelper) ConvertLocation ¶
Convert time to the given location
func (*TimeHelper) DefaultFormat ¶
func (this *TimeHelper) DefaultFormat(t time.Time) string
Use yyyy-mm-dd HH:MM:SS.ms format the time