Documentation ¶
Index ¶
- Constants
- Variables
- func CheckPassword(p, c string) error
- func CopyBean(bean interface{}) (newBean interface{}, err error)
- func CryptKey() string
- func CryptoRandInt(n int) *big.Int
- func DecryptPassword(p string) (s string, err error)
- func EncryptPassword(p string) string
- func FileAbsPath(path string) string
- func FindPidSliceByProcessName(name string) []string
- func FloatPrecision(f *float64, p int) float64
- func InjectPopulate(values ...interface{})
- func JSONDump(val interface{}, args ...interface{}) string
- func JSONMarshalToBase64(val interface{}) ([]byte, error)
- func JSONUnmarshalFromBase64(data []byte, val interface{}) error
- func JsMarshal(val interface{}) (bts []byte)
- func JsMarshalIndent(val interface{}) (bts []byte)
- func KillProcess(name string) (err error)
- func MathRandInt(n int) int
- func MergeBean(dst interface{}, src Map) (err error)
- func MergeBeans(dst interface{}, src interface{}) (err error)
- func NewValue(bean interface{}) (val interface{})
- func ObjectTagInstances(obj interface{}, tagName string) []interface{}
- func ProcessIsRunning(name string) bool
- func RandUseragent() string
- func RetryDo(fn func() error, intervalSecond int64) error
- func RetryDoTimes(times, intervalSecond int64, fn func() error) error
- func SetTimeZone() error
- func ShortUUID() string
- func TextTemplateMustParse(text string, data interface{}) (result string)
- func Ticker(d time.Duration, fn func())
- func TimeExcWrap(fn func()) time.Duration
- func TimeNow() time.Time
- func TodayDate() string
- func TranslateSlice2Interfaces(sl interface{}) []interface{}
- func UUIDString() string
- func ValueIndirect(val reflect.Value) reflect.Value
- func Write2file(fileName, content string)
- type ABFileOption
- type AbFile
- type Captcha
- type Config
- type Crypto
- type G2cron
- type GoPool
- type Graceful
- type IWriter
- type ItfExec
- type ItfGracefulProcess
- type JSONTime
- func (p *JSONTime) Add(d time.Duration) *JSONTime
- func (p JSONTime) Addr() *JSONTime
- func (p *JSONTime) Convert2Time() time.Time
- func (p *JSONTime) Date() *JSONTime
- func (p *JSONTime) GobDecode(data []byte) error
- func (p *JSONTime) GobEncode() ([]byte, error)
- func (p *JSONTime) MarshalJSON() ([]byte, error)
- func (p *JSONTime) Scan(v interface{}) error
- func (p *JSONTime) SetByTime(timeVal time.Time)
- func (p *JSONTime) String() string
- func (p *JSONTime) StringFormat(layout string) string
- func (p *JSONTime) Time() time.Time
- func (p *JSONTime) UnmarshalJSON(data []byte) error
- func (p *JSONTime) Value() (driver.Value, error)
- type Level
- type LevelLogger
- type Map
- func (m Map) GetBool(key string) bool
- func (m Map) GetInt(key string) int
- func (m Map) GetInt64(key string) int64
- func (m Map) GetString(key string) string
- func (m Map) Keys() []string
- func (m Map) MarshalBinary() (data []byte, err error)
- func (m Map) Merge2Bean(bean interface{}) (err error)
- func (m Map) MergeTo(mp Map)
- func (m Map) ToBean(bean interface{}) (err error)
- func (m *Map) UnmarshalBinary(data []byte) error
- type MapString
- type RestyAgent
- type Validator
- func (v *Validator) Constructor()
- func (v *Validator) New() *Validator
- func (v *Validator) TranslateZh(es error) (err error)
- func (v *Validator) Valid() *validator.Validate
- func (v *Validator) ValidAndTranslateZh(s interface{}) (err error)
- func (v *Validator) ValidVarWithTransZh(val interface{}, tag string) (err error)
Constants ¶
const ( //TimeZone ... TimeZone = "Asia/Shanghai" //Custom ... Custom = "2006-01-02 15:04:05" //DateLayout ... DateLayout = "2006-01-02" )
const (
MB int
)
常量,大小定义
Variables ¶
var TimeNowFunc = time.Now
TimeNowFunc ...
var Valid = new(Validator).New()
Valid ...
Functions ¶
func CopyBean ¶ added in v2.0.4
func CopyBean(bean interface{}) (newBean interface{}, err error)
CopyBean ... *
- @Description: copy原始数据到新数据
- @param bean
- @return newBean
- @return err
func DecryptPassword ¶ added in v2.2.1
DecryptPassword ...
func FindPidSliceByProcessName ¶ added in v2.0.3
FindPidSliceByProcessName get pid list
func FloatPrecision ¶ added in v2.2.1
FloatPrecision 浮点型精度包装
func JSONDump ¶ added in v2.0.4
func JSONDump(val interface{}, args ...interface{}) string
JSONDump ...
func JSONMarshalToBase64 ¶ added in v2.2.1
JSONMarshalToBase64 ...
func JSONUnmarshalFromBase64 ¶ added in v2.2.1
JSONUnmarshalFromBase64 ...
func JsMarshalIndent ¶ added in v2.2.1
func JsMarshalIndent(val interface{}) (bts []byte)
JsMarshalIndent ...
func KillProcess ¶ added in v2.0.3
KillProcess ...kill process
func MergeBean ¶ added in v2.2.1
MergeBean ... @Description: merge struct's point, merge src to dst @param dst @param src
func MergeBeans ¶ added in v2.0.4
func MergeBeans(dst interface{}, src interface{}) (err error)
MergeBeans ... 合并结构数据
func ObjectTagInstances ¶ added in v2.0.4
func ObjectTagInstances(obj interface{}, tagName string) []interface{}
ObjectTagInstances ... *
- @Description:根据标签获取字段实例集合
- @param obj
- @param tagName
- @return []interface{}
func ProcessIsRunning ¶ added in v2.0.3
ProcessIsRunning is running
func RetryDoTimes ¶ added in v2.0.3
RetryDoTimes ...
func TextTemplateMustParse ¶ added in v2.0.2
TextTemplateMustParse ...
func TranslateSlice2Interfaces ¶ added in v2.2.1
func TranslateSlice2Interfaces(sl interface{}) []interface{}
TranslateSlice2Interfaces ...
func ValueIndirect ¶ added in v2.0.2
ValueIndirect ...值类型
Types ¶
type ABFileOption ¶ added in v2.0.3
type ABFileOption struct { //文件最大值,超过该值自动备份,备份文件大小略大于该值 FileMaxSize int //保存目录天数 SaveDays int //writer buffer size,内存缓冲区大小 BufferSize int //自动刷新数据到磁盘的周期,默认值为2秒 AutoFlushPeriod time.Duration //检查删除过期文件目录间隔 AutoDelPeriod time.Duration }
ABFileOption 参数配置
type AbFile ¶ added in v2.0.3
type AbFile struct { Config *Config `inject:""` Graceful *Graceful `inject:""` // contains filtered or unexported fields }
AbFile ...
type Captcha ¶ added in v2.2.1
type Captcha struct {
// contains filtered or unexported fields
}
Captcha ...
func (*Captcha) SetCap ¶ added in v2.2.1
func (c *Captcha) SetCap(cap *base64Captcha.Captcha)
SetCap ...
type Config ¶ added in v2.0.3
type Config struct {
// contains filtered or unexported fields
}
Config ...
func (*Config) SetFilename ¶ added in v2.0.3
SetFilename ...
func (*Config) SetRootPath ¶ added in v2.0.3
SetRootPath ...
type Crypto ¶ added in v2.2.1
type Crypto struct {
// contains filtered or unexported fields
}
Crypto ...
func (*Crypto) DecryptCBC ¶ added in v2.2.1
DecryptCBC ...
func (*Crypto) EncryptCBC ¶ added in v2.2.1
EncryptCBC ...
type G2cron ¶ added in v2.0.3
type G2cron struct { Logger LevelLogger `inject:""` // contains filtered or unexported fields }
G2cron ...
func (*G2cron) OnProcessStart ¶ added in v2.0.3
func (c *G2cron) OnProcessStart()
OnProcessStart ...启动定时任务
type GoPool ¶ added in v2.0.3
type GoPool struct { LevelLogger LevelLogger `inject:""` Grace *Graceful `inject:""` // contains filtered or unexported fields }
GoPool ...goroutine pool
type Graceful ¶ added in v2.0.3
type Graceful struct { Logger LevelLogger `inject:""` // contains filtered or unexported fields }
Graceful ...
func (*Graceful) RegHTTPServer ¶ added in v2.0.3
RegHTTPServer ...注册一个http服务
func (*Graceful) RegProcessor ¶ added in v2.0.3
func (g *Graceful) RegProcessor(p ItfGracefulProcess)
RegProcessor ...注册一个对象,用于关闭程序后的行为
func (*Graceful) WaitForSignal ¶ added in v2.0.3
func (g *Graceful) WaitForSignal()
WaitForSignal ...
type IWriter ¶ added in v2.0.3
type IWriter interface { AfterShutdown() Closed() bool Close() Flush() (err error) Write(p []byte) (n int, err error) File() *os.File }
IWriter ...
type ItfExec ¶ added in v2.0.3
type ItfExec interface { Start() error Run() error Output() ([]byte, error) CombinedOutput() ([]byte, error) }
ItfExec ...
func NewExecInner ¶ added in v2.0.3
NewExecInner ...
type ItfGracefulProcess ¶ added in v2.0.3
type ItfGracefulProcess interface{ AfterShutdown() }
ItfGracefulProcess 接口,提供给关闭后行为
type JSONTime ¶ added in v2.0.3
JSONTime ...
func Must2JSONTimeAddr ¶ added in v2.0.3
Must2JSONTimeAddr maybe panic
func NewJSONTimeOfTime ¶ added in v2.0.3
NewJSONTimeOfTime 时间转换为JSONTime
func (*JSONTime) Convert2Time ¶ added in v2.0.3
Convert2Time ...
func (*JSONTime) MarshalJSON ¶ added in v2.0.3
MarshalJSON ...
func (*JSONTime) StringFormat ¶ added in v2.0.3
StringFormat 转换为固定格式字符串
func (*JSONTime) UnmarshalJSON ¶ added in v2.0.3
UnmarshalJSON ...
type Level ¶ added in v2.0.3
type Level uint32
Level type
level
func ParseLevel ¶ added in v2.0.3
ParseLevel takes a string level and returns the log level constant.
func (Level) MarshalText ¶ added in v2.0.3
MarshalText ...
func (Level) String ¶ added in v2.0.3
Convert the Level to a string. E.g. PanicLevel becomes "panic".
func (*Level) UnmarshalText ¶ added in v2.0.3
UnmarshalText implements encoding.TextUnmarshaler.
type LevelLogger ¶ added in v2.0.3
type LevelLogger interface { SetOutput(io.Writer) Writer() io.Writer Print(...interface{}) Printf(string, ...interface{}) Println(...interface{}) Fatal(...interface{}) Fatalf(string, ...interface{}) Fatalln(...interface{}) Panic(...interface{}) Panicf(string, ...interface{}) Panicln(...interface{}) Debugf(string, ...interface{}) Infof(string, ...interface{}) Warnf(string, ...interface{}) Errorf(string, ...interface{}) SetLevel(lvl Level) }
LevelLogger ...
func NewLevelLogger ¶ added in v2.0.3
func NewLevelLogger(prefix string, out ...io.Writer) LevelLogger
NewLevelLogger ...
type Map ¶ added in v2.0.2
type Map map[string]interface{}
Map ...
func (Map) MarshalBinary ¶ added in v2.0.2
MarshalBinary ...
func (Map) Merge2Bean ¶ added in v2.0.4
Merge2Bean ...
func (*Map) UnmarshalBinary ¶ added in v2.0.2
UnmarshalBinary ...
type MapString ¶ added in v2.2.1
MapString ...
func (MapString) TransMapStringToMap ¶ added in v2.2.1
TransMapStringToMap ...
type RestyAgent ¶ added in v2.0.3
type RestyAgent struct { Logger LevelLogger `inject:""` // contains filtered or unexported fields }
RestyAgent ...
func (*RestyAgent) SetDialTimeout ¶ added in v2.0.3
func (a *RestyAgent) SetDialTimeout(d time.Duration) *RestyAgent
SetDialTimeout ... 非线程安全
func (*RestyAgent) SetProxy ¶ added in v2.0.3
func (a *RestyAgent) SetProxy(proxyURL string, user *url.Userinfo) *RestyAgent
SetProxy ... 非线程安全
type Validator ¶ added in v2.2.1
type Validator struct {
// contains filtered or unexported fields
}
Validator ...
func (*Validator) TranslateZh ¶ added in v2.2.1
TranslateZh ...
func (*Validator) ValidAndTranslateZh ¶ added in v2.2.1
ValidAndTranslateZh ...
func (*Validator) ValidVarWithTransZh ¶ added in v2.2.1
ValidVarWithTransZh ...