Documentation ¶
Index ¶
- Constants
- Variables
- func BaseDir() string
- func DumpHex(bs []byte, wordsPerLine ...int) (s string)
- func ExecCommandAndFind(cmd Command, pattern string) (exitStatus int, results []string, err error)
- func Exists(path string) bool
- func FilePathJoinSafely(base string, children ...string) (string, error)
- func FindByRegexp(in, pattern string) (match []string)
- func GenKeyForMap(values ...string) string
- func GetBoolFromArgs(key string, defaultValueOrNone ...bool) (value bool)
- func GetFileInfo(path string) (abs, dir, pureFilename, suffix string)
- func GetFromArgs(key string, defaultValueOrNone ...string) (value string)
- func GetFuncInfo(skip int) (file string, line int, funcName string, ok bool)
- func GetIPs() (map[string][]*Address, error)
- func GetIntFromArgs(key string, defaultValueOrNone ...int64) (value int64)
- func GetInterface(flags ...net.Flags) ([]net.Interface, error)
- func GetInterfaceName(flags ...net.Flags) (names []string, e error)
- func GetLinuxStylePath(path string) (linuxPath string)
- func GetUintFromArgs(key string, defaultValueOrNone ...uint64) (value uint64)
- func HideString(s string, beginPosShown int, endPosShownOrNone ...int) string
- func IsByteVisible(c byte) bool
- func IsDir(path string) bool
- func IsFile(path string) bool
- func JsonDump(v interface{}, indent int) string
- func JsonDumpE(v interface{}, indent int) (result string, err error)
- func MapToStruct(inputMap map[string]interface{}, outStructPtr interface{}) error
- func MapToStructByJson(inputMap map[string]interface{}, outStructPtr interface{}) error
- func MergeMap(dest, addition map[string]interface{}, mode MergeMode)
- func MergeStruct(out, in interface{}, mode MergeMode) (result interface{}, err error)
- func Panic(err error, reason ...string)
- func PickArgs() map[string]string
- func PrintStack()
- func PythonLikePos(length, beg int, endOrNone ...int) (begin, end int)
- func PythonLikeSlice(s string, beg int, endOrNone ...int) string
- func RelativeDirByBase(targpath string) string
- func ResetHiddenReplacer(r string)
- func StructToMap(o interface{}) map[string]interface{}
- func StructToString(s interface{}, showZero ...bool) (result string)
- func VectorToMap(vector interface{}, keys ...string) (mapResult *map[string]interface{})
- type Address
- func (a Address) ConvertIPNet() (string, error)
- func (a Address) GetIpType() IpType
- func (a Address) MarshalJSON() ([]byte, error)
- func (a Address) String() (CIDR string)
- func (a Address) ToMultiaddr(returnErr ...*error) multiaddr.Multiaddr
- func (a *Address) ToTcpAddr(portOrNone ...int) (*net.TCPAddr, error)
- func (a *Address) UnmarshalJSON(data []byte) error
- type ByteSize
- func (s ByteSize) Add(arg ByteSize) ByteSize
- func (s ByteSize) Del(arg ByteSize) ByteSize
- func (s ByteSize) Div(arg ByteSize) ByteSize
- func (s ByteSize) GB() ByteSize
- func (s ByteSize) KB() ByteSize
- func (s ByteSize) MB() ByteSize
- func (s ByteSize) Mul(arg ByteSize) ByteSize
- func (s ByteSize) TB() ByteSize
- type CIDRAddress
- type Command
- type ExecResult
- type IpType
- type MergeMode
- type MyError
- type Version
- func (v *Version) Equal(w *Version) bool
- func (v *Version) FromDB(data []byte) error
- func (v *Version) GreaterThan(w *Version) bool
- func (v *Version) IsZero() bool
- func (v Version) MarshalJSON() ([]byte, error)
- func (v *Version) Set(ver string) error
- func (v *Version) String() string
- func (v *Version) ToDB() ([]byte, error)
- func (v *Version) UnmarshalJSON(data []byte) error
- func (v *Version) UnmarshalYAML(unmarshal func(interface{}) error) error
Constants ¶
View Source
const ( IpTypeUnknown = iota IpTypeV4 IPTypeV6 )
View Source
const ( BYTE ByteSize = 1 KB = 1024 * BYTE MB = 1024 * KB GB = 1024 * MB TB = 1024 * GB )
Common units for calculating size
View Source
const Separator = '='
Variables ¶
View Source
var (
)
View Source
var IsRelByBasedir = true
View Source
var (
TypeMustBeStruct = errors.New("type must be struct")
)
Functions ¶
func ExecCommandAndFind ¶
func FindByRegexp ¶
func GenKeyForMap ¶
func GetBoolFromArgs ¶
func GetFileInfo ¶
func GetFromArgs ¶
func GetIntFromArgs ¶
func GetLinuxStylePath ¶ added in v0.0.2
func GetUintFromArgs ¶
func IsByteVisible ¶ added in v0.0.2
func MapToStruct ¶ added in v0.0.7
func MapToStructByJson ¶ added in v0.0.8
func MergeStruct ¶ added in v0.0.3
func PrintStack ¶
func PrintStack()
func PythonLikePos ¶
func RelativeDirByBase ¶
func ResetHiddenReplacer ¶
func ResetHiddenReplacer(r string)
func StructToMap ¶ added in v0.0.3
func StructToMap(o interface{}) map[string]interface{}
func StructToString ¶ added in v0.0.3
func VectorToMap ¶
Types ¶
type Address ¶
func GetIPByInterfaceName ¶
func NewAddress ¶
func (Address) ConvertIPNet ¶
func (Address) MarshalJSON ¶
func (Address) ToMultiaddr ¶
func (*Address) UnmarshalJSON ¶
type CIDRAddress ¶
type CIDRAddress string
DEPRECATED:
func (CIDRAddress) ToAddress ¶
func (s CIDRAddress) ToAddress() (*Address, error)
type Command ¶
func NewCommand ¶
type ExecResult ¶
func ExecCommand ¶
func ExecCommand(name string, arg ...string) *ExecResult
func ExecCommandContext ¶
func ExecCommandContext(ctx context.Context, name string, arg ...string) *ExecResult
func NewExecResult ¶
func NewExecResult(stdout, stderr string, execErr error) *ExecResult
type MergeMode ¶ added in v0.0.5
type MergeMode int
const ( // Overwrite the non-empty fields in A (addition) over the corresponding fields in D (dest). // For short: A(non-empty fields) ----> D OverwriteWithNonEmpty MergeMode = iota // Overwrite all fields owned by A (addition). // For short: A(all fields) ----> D Overwrite // Fill in the blank field of D (dest) with corresponding fields in A (addition). // In this way, fields that have non-empty values will not be affected. // For short: A(non-empty fields that is empty in D) ----> D FillBlank )
Merge A -> D
type MyError ¶
func DealWithPanic ¶
func DealWithPanic(panicVal interface{}) *MyError
type Version ¶
type Version struct { Major uint16 // 主版本号 Minor uint16 // 次版本号 Patch uint16 // 修订版本号 Addition string // 附加信息 }
func NewVersion ¶
@param {string} ver 字符串格式的版本号,兼容格式 [v]1.2.3{foo}
func (*Version) GreaterThan ¶
func (Version) MarshalJSON ¶
func (*Version) UnmarshalJSON ¶
func (*Version) UnmarshalYAML ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.