kit

package module
v0.0.0-...-e72ea58 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 19 Imported by: 0

README

kit

工具包

Documentation

Index

Constants

View Source
const (
	SexUnknown sex = iota
	SexMan
	SexWoman
)

Variables

View Source
var (
	InvalidFunction = errors.New("the function is not a Func type")
)
View Source
var InvalidIdCardNumber = errors.New("invalid id card number")
View Source
var LocalIpEmptyErr = errors.New("local ip empty")

Functions

func BranchToYuan

func BranchToYuan(branch int) string

分转元

func BytesToString

func BytesToString(b []byte) string

func CallFunction

func CallFunction(function interface{}, args ...interface{}) (results []interface{}, err error)

func Caller

func Caller(skip int) (pc uintptr, file string, line int, ok bool)

func CallerFrame

func CallerFrame(skip int) (*runtime.Frame, bool)

func CreateFile

func CreateFile(path string) error

func CurrentDir

func CurrentDir() (path string, err error)

func FileIsExist

func FileIsExist(path string) bool

func HttpGet

func HttpGet(rawUrl string, response io.Writer) error

func HttpGetTimeout

func HttpGetTimeout(rawUrl string, response io.Writer, timeout time.Duration) error

func HttpPost

func HttpPost(rawUrl string, body io.Reader, response io.Writer) error

func HttpPostTimeout

func HttpPostTimeout(rawUrl string, body io.Reader, response io.Writer, timeout time.Duration) error

func HttpRequest

func HttpRequest(method, rawUrl string, req io.Reader, rsp io.Writer, timeout time.Duration, tlsCfg *tls.Config) error

func HttpsGet

func HttpsGet(rawUrl string, response io.Writer, tlsCfg *tls.Config) error

func HttpsGetTimeout

func HttpsGetTimeout(rawUrl string, response io.Writer, timeout time.Duration, tlsCfg *tls.Config) error

func HttpsPost

func HttpsPost(rawUrl string, body io.Reader, response io.Writer, tlsCfg *tls.Config) error

func HttpsPostTimeout

func HttpsPostTimeout(rawUrl string, body io.Reader, response io.Writer, timeout time.Duration, tlsCfg *tls.Config) error

func IdCardSex

func IdCardSex(number string) (sex, error)

通过身份证号获取性别 15位的身份证号:最后一位奇数表示男,偶数表示女 18位的身份证号:倒数第二位奇数表示男,偶数表示女

func JsonDecoding

func JsonDecoding(r io.Reader, v interface{}) error

func JsonEncoding

func JsonEncoding(v interface{}, w io.Writer) error

func JsonIterDecoding

func JsonIterDecoding(r io.Reader, v interface{}) error

func JsonIterEncoding

func JsonIterEncoding(v interface{}, w io.Writer) error

func LocalIP

func LocalIP() (string, error)

func LocalIPByTcpDial

func LocalIPByTcpDial(address string, timeout time.Duration) (string, error)

func MakeDir

func MakeDir(path string) error

func OpenFile

func OpenFile(path string, flag int, perm os.FileMode) (file *os.File, err error)

func RandomCode

func RandomCode(length int) []byte

func ReadDir

func ReadDir(path string, reader func(os.FileInfo) bool) error

func RemoveDir

func RemoveDir(path string) error

func RemoveFile

func RemoveFile(path string) error

func StringToBytes

func StringToBytes(s string) []byte

func YuanToBranch

func YuanToBranch(yuan 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