Documentation ¶
Index ¶
- Constants
- Variables
- func AddHttpProtocal(url string) string
- func CreateDirIfNotExist(dir string) (err error)
- func ExtractField(slice []string) (s []string, err error)
- func GetEnv(env string) string
- func GetExtraInfo() map[string]string
- func GetIdentifyIDByFile(f *os.File) (uint64, error)
- func GetIdentifyIDByPath(path string) (uint64, error)
- func GetLocalIP() (string, error)
- func GetRealPath(path string) (newPath string, fi os.FileInfo, err error)
- func IsJSON(str string) bool
- func MongoDail(host string, mode string, syncTimeoutInS int64) (session *mgo.Session, err error)
- func ReadDirByTime(dir string) (files []os.FileInfo, err error)
- func RemoveHttpProtocal(url string) (hostport, schema string)
- func SetMode(s *mgo.Session, modeFriendly string, refresh bool)
- func SortFilesByTime(files []os.FileInfo) (soredfiles []os.FileInfo)
- func TrimeList(strs []string) (ret []string)
- func TuoDecode(value []byte) (values [][]byte, err error)
- func TuoEncode(values []sql.RawBytes) (ret []byte)
- func WaitForInterrupt(interrupt func())
- type Collection
- type ErrorResponse
- type File
- type HashSet
- func (s *HashSet) Add(ele interface{})
- func (s *HashSet) AddStringArray(ele []string)
- func (s *HashSet) Clear()
- func (s *HashSet) Elements() []interface{}
- func (s *HashSet) IsEmpty() bool
- func (s *HashSet) IsIn(ele interface{}) bool
- func (s *HashSet) Len() int
- func (s *HashSet) Remove(ele interface{})
- type Int64Slice
- type KeyValue
- type MongoConfig
- type OSInfo
- type Option
- type StatsError
- type StatsInfo
Constants ¶
View Source
const ( // 一切正常 ErrNothing = "L200" // 单机版 Runner 操作 ErrConfigName = "L1001" ErrRunnerAdd = "L1002" ErrRunnerDelete = "L1003" ErrRunnerStart = "L1004" ErrRunnerStop = "L1005" ErrRunnerReset = "L1006" ErrRunnerUpdate = "L1007" // parse 相关 ErrParseParse = "L1101" // 集群版 master API ErrClusterSlaves = "L2001" ErrClusterStatus = "L2002" ErrClusterConfigs = "L2003" ErrClusterRegister = "L2004" // 集群版 slave API ErrClusterTag = "L2005" // 集群版 master 对 slaves 的操作 ErrClusterRunnerAdd = "L2006" ErrClusterRunnerDelete = "L2007" ErrClusterRunnerStart = "L2008" ErrClusterRunnerStop = "L2009" ErrClusterRunnerReset = "L2010" ErrClusterRunnerUpdate = "L2011" ErrClusterSlavesDelete = "L2012" ErrClusterSlavesTag = "L2013" )
View Source
const (
GlobalKeyName = "name"
)
Variables ¶
View Source
var ErrorCodeHumanize = map[string]string{ ErrNothing: "操作成功", ErrConfigName: "获取 Config 出现错误", ErrRunnerAdd: "添加 Runner 出现错误", ErrRunnerDelete: "删除 Runner 出现错误", ErrRunnerStart: "开启 Runner 出现错误", ErrRunnerStop: "关闭 Runner 出现错误", ErrRunnerReset: "重置 Runner 出现错误", ErrRunnerUpdate: "更新 Runner 出现错误", ErrParseParse: "解析字符串失败", ErrClusterSlaves: "获取 Slaves 列表出现错误", ErrClusterStatus: "获取 Slaves 状态出现错误", ErrClusterConfigs: "获取 Slaves Configs 出现错误", ErrClusterRegister: "接受 Slaves 注册出现错误", ErrClusterTag: "更改 Tag 出现错误", ErrClusterRunnerAdd: "Slaves 添加 Runner 出现错误", ErrClusterRunnerDelete: "Slaves 删除 Runner 出现错误", ErrClusterRunnerStart: "Slaves 启动 Runner 出现错误", ErrClusterRunnerStop: "Slaves 关闭 Runner 出现错误", ErrClusterRunnerReset: "Slaves 重置 Runner 出现错误", ErrClusterRunnerUpdate: "Slaves 更新 Runner 出现错误", ErrClusterSlavesDelete: "Slaves 从列表中移除时出现错误", ErrClusterSlavesTag: "Slaves 更改 Tag 出现错误", }
Functions ¶
func AddHttpProtocal ¶ added in v1.3.6
func CreateDirIfNotExist ¶
CreateDirIfNotExist 检查文件夹,不存在时创建
func ExtractField ¶ added in v1.3.6
func GetExtraInfo ¶ added in v1.4.0
func GetIdentifyIDByPath ¶
func GetLocalIP ¶ added in v1.3.6
func GetRealPath ¶
GetRealPath 处理软链接等,找到文件真实路径
func ReadDirByTime ¶
ReadDirByTime 读取文件目录后按时间排序,时间最新的文件在前
func RemoveHttpProtocal ¶ added in v1.3.6
func SortFilesByTime ¶
SortFilesByTime 按照文件更新的unixnano从大到小排,即最新的文件在前
func WaitForInterrupt ¶
func WaitForInterrupt(interrupt func())
Types ¶
type Collection ¶
type Collection struct {
*mgo.Collection
}
func (Collection) CloseSession ¶
func (c Collection) CloseSession() (err error)
type ErrorResponse ¶ added in v1.2.3
type ErrorResponse struct {
Error error `json:"error"`
}
func NewErrorResponse ¶ added in v1.2.3
func NewErrorResponse(err error) *ErrorResponse
type File ¶
func GetLogFiles ¶
type HashSet ¶ added in v1.4.0
type HashSet struct {
// contains filtered or unexported fields
}
func NewHashSet ¶ added in v1.4.0
func NewHashSet() *HashSet
func (*HashSet) AddStringArray ¶ added in v1.4.0
type Int64Slice ¶
type Int64Slice []int64
Int64Slice attaches the methods of Interface to []int64, sorting in decreasing order.
func (Int64Slice) Len ¶
func (p Int64Slice) Len() int
func (Int64Slice) Less ¶
func (p Int64Slice) Less(i, j int) bool
func (Int64Slice) Swap ¶
func (p Int64Slice) Swap(i, j int)
type MongoConfig ¶
type StatsError ¶
type StatsError struct { StatsInfo ErrorDetail error `json:"error"` Ft bool `json:"-"` ErrorIndex []int }
func (*StatsError) AddErrors ¶
func (se *StatsError) AddErrors()
func (*StatsError) AddSuccess ¶
func (se *StatsError) AddSuccess()
func (*StatsError) Error ¶
func (se *StatsError) Error() string
func (*StatsError) ErrorIndexIn ¶
func (se *StatsError) ErrorIndexIn(idx int) bool
Click to show internal directories.
Click to hide internal directories.