base

package
v0.0.0-...-7c10af5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2019 License: LGPL-3.0 Imports: 20 Imported by: 0

README

##说明

  • m_file: 文件操作相关功能
  • m_properties: 读取properties配置文件的内容
  • m_shell: 执行shell命令
  • m_string: 字符串相关操作
  • m_type: 数据类型转换功能
  • m_uuid: 生成机器码
  • m_error: 自定义错误信息功能
  • m_log: beego的日志功能进行了定制
  • m_md5: 将字符串用MD5进行加密
  • m_token: 获取token字符串,可选长度、是否MD5加密

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllMac

func AllMac() (string, error)

func CheckIsExist

func CheckIsExist(addr string) bool

检查路径是否存在。文件和目录都可以检查。

func CleanSpace

func CleanSpace(str string) string

清除字符串中的空白

func ClearDir

func ClearDir(dir_path string) (string, error)

清空目录, 先删除,再创建

func DataPage

func DataPage(all_num, page, number int64) (start_number, end_number int64, err error)

数据分页计算器

func ErrorCustom

func ErrorCustom(text string) error

自定义错误信息

func Float64ToStr

func Float64ToStr(x float64) string

func GetFileSize

func GetFileSize(file_addr string) (string, int64)

获取本地文件的大小,返回2个值,一个是带单位的字符串,一个是不带单位的字节

func GetRootPath

func GetRootPath() string

获取文件的上级目录绝对路径

func GetSize

func GetSize(obj int64) string

获取文件大小的精确值

func GetToken

func GetToken(length int, ismd5 bool) string

func GetUUID

func GetUUID(org_id, machine_type, regist_number string) (string, error)

获取机器码

func Get_dir_name

func Get_dir_name(dirPth string) ([]string, error)

获取指定目录下的所有目录名称,不进入下一级目录搜索。

func Int64ToStr

func Int64ToStr(x int64) string

func IntToStr

func IntToStr(x int) string

func ParseJsonFile

func ParseJsonFile(filename string, v interface{}) error

解析JSON文件: json文件的数据结构 和 接口对象的数据结构 必须要一致!!!

func Properties_Get_Value

func Properties_Get_Value(file_path, key string) string

获取properties文件中KEY的值

func ReadAll

func ReadAll(filePth string) ([]byte, error)

用于读取文件,一次性读取所有的。这个函数用于读取存储提示信息等小段信息的操作。

func Readline

func Readline(file_path string) ([]string, error)

按行读取文件。注意:1行文字,返回空字符串切片

func ShExec

func ShExec(path, cmd string, args ...string) (string, error)

使用方法,有目录写目录,没有目录用"."或者""表示当前目录

func Splitstr

func Splitstr(str string, start int, end int) string

截取字符串,参数:字符串,开始顺序[第一个数开始算,不是索引,索引是从0开始,顺序是从1开始],结束顺序[第几个字符,包含这个字符]

func StrContains

func StrContains(str, obj string) bool

检查字符串中是否包含某个字符,支持单字符和词汇的检查

func StrCount

func StrCount(str, obj string) int

检查字符或字符串出现的次数

func StrHasPrefix

func StrHasPrefix(str, prefix string) bool

检查字符串是不是以某个字符或字符串开始的

func StrHasSuffix

func StrHasSuffix(str, prefix string) bool

检查字符串是不是以某个字符或字符串结尾的

func StrMD5

func StrMD5(str string) string

func StrSHA1

func StrSHA1(str string) string

func StrSHA256

func StrSHA256(str string) string

func StrSHA512

func StrSHA512(str string) string

func StrToFloat64

func StrToFloat64(x string) (float64, error)

func StrToInt

func StrToInt(x string) (int, error)

func StrToInt64

func StrToInt64(x string) (int64, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL