tools

package
v0.0.0-...-aa951f0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteTransformation

func ByteTransformation(data int64, method string) float64

字节容量转换

func DirCreate

func DirCreate(path string) (bool, error)

创建目录

func EnumerateDate

func EnumerateDate() (year, month, day string)

获取当前年份 月份 日期

func FileMove

func FileMove(source, target string) error

文件移动

func FileRemove

func FileRemove(path string) error

文件删除

func GetFileSuffix

func GetFileSuffix(tempname string) string

获得文件后缀

func Int64ToString

func Int64ToString(timeStamp int64) string

整形64转字符串

func IntToString

func IntToString(timeStamp int) string

整形转字符串

func StringToInt

func StringToInt(data string) int

字符串转int

func StringToInt64

func StringToInt64(data string) int64

字符串转int64

func StringToMd5

func StringToMd5(str string, length int64) string

字符串转md5

func TimeToString

func TimeToString(accurate bool) string

时间转字符串 参数 true 精确到时分秒 false 精确到日期

func UnixTimeToString

func UnixTimeToString(stamp string) string

将字符串类型的时间戳参数转为时间字符串

Types

type Cos

type Cos struct {
	Bucket string //Bucket
	Appid  string //APPID
	Region string //Region
	Skid   string //SecretID
	Sk     string //SecretKey
}

腾讯云

func (*Cos) Delete

func (this *Cos) Delete(objectName string) error

func (*Cos) List

func (this *Cos) List() (error, cos.BucketGetResult)

func (*Cos) Upload

func (this *Cos) Upload(filePath, saveName string) error

type Entity

type Entity interface {
	Upload(string, string) error
	Delete(string) error
}

实体操作

type EntityFactory

type EntityFactory struct {
}

实体工厂

func (*EntityFactory) Create

func (this *EntityFactory) Create(flag string, entity interface{}) Entity

工厂制造实体

type Oss

type Oss struct {
	Bucket   string //Bucket
	Ak       string //Accesskey
	Sk       string //Secretkey
	Endpoint string //地域节点
}

阿里云

func (*Oss) Delete

func (this *Oss) Delete(key string) error

func (*Oss) List

func (this *Oss) List() (oss.ListObjectsResult, error)

func (*Oss) Upload

func (this *Oss) Upload(key, filePath string) error

type Paging

type Paging struct {
	Page      int64 //当前页面
	PageSize  int64 //每页条数
	Total     int64 //文章总条数
	PageCount int64 //分页后总页数
}

func CreatePaging

func CreatePaging(page, pagesize, total int64) *Paging

type Qiniu

type Qiniu struct {
	Accesskey string
	Secretkey string
	Bucket    string
	Zone      string
	Url       string
	Host      string
	Parameter string
}

func (*Qiniu) Delete

func (this *Qiniu) Delete(code string) error

func (*Qiniu) GeneratingVoucher

func (this *Qiniu) GeneratingVoucher() string

管理凭证生成

func (*Qiniu) GetBucketData

func (this *Qiniu) GetBucketData() (error, []byte)

获取Bucket的数据

func (*Qiniu) List

func (this *Qiniu) List() (error, []byte, string)

func (*Qiniu) Upload

func (this *Qiniu) Upload(filePath, key string) error

type ResponseError

type ResponseError struct {
	Errors string `json:"error"`
}

七牛云删除响应

type Upyun

type Upyun struct {
	Bucket   string //Bucket
	Operator string //Operator
	Password string //Password
	Domain   string //Domain
}

func (*Upyun) Delete

func (this *Upyun) Delete(remote string) error

func (*Upyun) List

func (this *Upyun) List(path string) []UpyunList

func (*Upyun) Upload

func (this *Upyun) Upload(remote, local string) error

type UpyunList

type UpyunList struct {
	Name string
	Size int64
	Time time.Time
	Path string
}

Jump to

Keyboard shortcuts

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