Documentation
¶
Index ¶
- func CopyFile(src, dst string, overwrite bool, perm os.FileMode, copyAttr bool) error
- func CopyFileAttr(src, dst string) error
- func CreateFileIfNotExist(path string, content []byte, perm os.FileMode, overwrite bool) error
- 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 ReadJsonFile(filePath string, data any) error
- func Remove(path string) error
- func StrReplace(search interface{}, replace interface{}, subject interface{}, count int) (interface{}, error)
- func ToString(value interface{}) (key string)
- type ArrStr
- type MapStrInterface
- type Struct2JsonOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFileIfNotExist ¶
CreateFileIfNotExist 判断文件是否存在,不存在则根据传入的文件内容创建,可设置文件权限,可设置是否覆盖
func JsonStr2Map ¶ added in v0.1.2
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
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.