Documentation
¶
Index ¶
- func CopyFile(src, dst string, overwrite bool, perm os.FileMode, copyAttr bool) error
- func CopyFileAttr(src, dst string) error
- func CreateFile(path string, content []byte, perm os.FileMode, overwrite bool) error
- func CreateFileIfNotExist(path string, content []byte, perm os.FileMode, overwrite bool) errordeprecated
- func DirExists(path string, create bool, perm os.FileMode) (bool, error)
- func DirName(path string) string
- func FileExists(path string) bool
- func GetAbsPath(path string) (string, error)
- func InArray(val interface{}, array interface{}) (exists bool)
- func IsDir(path string) bool
- func IsEmpty(path string) bool
- func IsEmptyDir(path string) bool
- func IsEmptyFile(path string) bool
- func IsExecutable(path string) bool
- func IsFile(path string) bool
- func IsHidden(path string) bool
- func IsReadable(path string) bool
- func IsSymlink(path string) bool
- func IsWritable(path string) bool
- func JsonStr2Map(str string) map[string]interface{}
- func JsonStrSort(jsonStr string) string
- func ParseIP(s string) (net.IP, int)
- func PasswordHash(password string) (string, error)
- func PasswordVerify(password, hash string) bool
- func ReadJsonFile(filePath string, data any) error
- func Remove(path string) error
- func Str2Int(str string) intdeprecated
- func StrReplace(search interface{}, replace interface{}, subject interface{}, count int) (interface{}, error)
- func ToArrByte(value interface{}) (arrByte []byte)
- func ToBool(value interface{}) (b bool)
- func ToFileMode(value interface{}) (mode os.FileMode)
- func ToInt(value interface{}) (i int)
- func ToString(value interface{}) (key string)
- type ArrStr
- type MapStrInterface
- type Struct2JsonOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFile ¶ added in v0.2.1
CreateFile 创建文件,可设置文件权限,可设置是否覆盖
func JsonStr2Map ¶ added in v0.1.2
func PasswordHash ¶ added in v0.2.1
func PasswordVerify ¶ added in v0.2.1
func ReadJsonFile ¶
ReadJsonFile 读取json文件,并解析到结构体
func StrReplace ¶ added in v0.1.2
func StrReplace(search interface{}, replace interface{}, subject interface{}, count int) (interface{}, error)
StrReplace 类似于php中的str_replace
func ToArrByte ¶ added in v0.2.1
func ToArrByte(value interface{}) (arrByte []byte)
ToArrByte 将变量转为[]byte类型
func ToFileMode ¶ added in v0.2.1
ToFileMode 将变量转为os.FileMode类型
Types ¶
type ArrStr ¶ added in v0.1.2
func (*ArrStr) ArrayIntersect ¶ added in v0.1.2
func (*ArrStr) ArrayValue ¶ added in v0.1.2
type MapStrInterface ¶ added in v0.1.2
func SetMapStrInterface ¶ added in v0.1.2
func SetMapStrInterface(data map[string]interface{}) *MapStrInterface
func (*MapStrInterface) ArrayKeys ¶ added in v0.1.2
func (d *MapStrInterface) ArrayKeys() []string
func (*MapStrInterface) ArrayValues ¶ added in v0.1.2
func (d *MapStrInterface) ArrayValues() []interface{}
func (*MapStrInterface) DoSort ¶ added in v0.1.2
func (d *MapStrInterface) DoSort() *MapStrInterface
func (*MapStrInterface) GetData ¶ added in v0.1.2
func (d *MapStrInterface) GetData() map[string]interface{}
type Struct2JsonOpt ¶ added in v0.1.2
type Struct2JsonOpt struct {
Struct interface{} // 结构体
Sort bool // 是否需要排序
NeedFile bool // 是否需要输出json文件
FilePath string // 输出json文件路径
}
func SetStruct ¶ added in v0.1.2
func SetStruct(_struct interface{}) *Struct2JsonOpt
func (*Struct2JsonOpt) DoSort ¶ added in v0.1.2
func (opt *Struct2JsonOpt) DoSort() *Struct2JsonOpt
func (*Struct2JsonOpt) File ¶ added in v0.1.2
func (opt *Struct2JsonOpt) File(filepath string) *Struct2JsonOpt
func (*Struct2JsonOpt) ToJson ¶ added in v0.1.2
func (opt *Struct2JsonOpt) ToJson() (string, error)
Click to show internal directories.
Click to hide internal directories.