utils

package
v0.0.0-...-8296c84 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT, GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BASE_64_TABLE = "1234567890poiuytreqwasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM-_"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Convert

type Convert struct{}

func NewConvert

func NewConvert() *Convert

func (*Convert) BoolToInt

func (convert *Convert) BoolToInt(boolValue bool) int

bool 转化为 int

func (*Convert) BoolToString

func (convert *Convert) BoolToString(boolValue bool) string

bool 转化为字符串

func (*Convert) FloatToString

func (convert *Convert) FloatToString(f float64, fmt byte, prec, bitSize int) string

float 转化为字符串

func (*Convert) IntToBool

func (convert *Convert) IntToBool(number int) bool

int 转化为 bool

func (*Convert) IntToString

func (convert *Convert) IntToString(number int64, base int) string

int 转化为字符串 base 范围 2-32 进制

func (*Convert) IntToTenString

func (convert *Convert) IntToTenString(number int) string

int 转化为10进制字符串 IntToString(number, 10)

func (*Convert) StringToInt

func (convert *Convert) StringToInt(str string) int

string to int(10进制)

func (*Convert) StringToInt64

func (convert *Convert) StringToInt64(str string) int64

string to int64(10进制)

type Date

type Date struct{}

func NewDate

func NewDate() *Date

func (*Date) Format

func (date *Date) Format(unixTime interface{}, format string) string

格式化 unix 时间戳

type Encrypt

type Encrypt struct{}

func NewEncrypt

func NewEncrypt() *Encrypt

func (*Encrypt) Base64Decode

func (encrypt *Encrypt) Base64Decode(str string) (string, error)

base64 解密

func (*Encrypt) Base64DecodeBytes

func (encrypt *Encrypt) Base64DecodeBytes(str string) ([]byte, error)

base64 解密

func (*Encrypt) Base64Encode

func (encrypt *Encrypt) Base64Encode(str string) string

base64 加密

func (*Encrypt) Base64EncodeBytes

func (encrypt *Encrypt) Base64EncodeBytes(bytes []byte) []byte

base64 加密

func (*Encrypt) Md5Encode

func (encrypt *Encrypt) Md5Encode(str string) string

md5加密

type Misc

type Misc struct{}

func NewMisc

func NewMisc() *Misc

func (*Misc) Page

func (m *Misc) Page(total, page, pagesize int, url string, args ...interface{}) string

*

  • 分页方法
  • @param type $total 一共多少记录
  • @param type $page 当前是第几页
  • @param type $pagesize 每页多少
  • @param type $url url是什么,url里面的{page}会被替换成页码
  • @param array $order 分页条的组成,是一个数组,可以按着1-6的序号,选择分页条组成部分和每个部分的顺序
  • @param int $a_count 分页条中a页码链接的总数量,不包含当前页的a标签,默认10个。
  • @return type String
  • echo Sr::page(100,3,10,'?article/list/{page}',array(3,4,5,1,2,6));

func (*Misc) RandString

func (m *Misc) RandString(strlen int) string

type Urls

type Urls struct{}

func NewUrls

func NewUrls() *Urls

func (*Urls) UrlEncode

func (urls *Urls) UrlEncode(urlStr string) string

Jump to

Keyboard shortcuts

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