Documentation ¶
Index ¶
- Constants
- Variables
- func AddDateByDayNum(input *time.Time, dayNum int)
- func Base64Decode(input string) string
- func Base64Encode(input string) string
- func CalcDayNum(start *time.Time, end *time.Time) int
- func Capitalize(str string) string
- func DateFromTime(input *time.Time) time.Time
- func EndDayOfTheMonth(in time.Time) time.Time
- func GenRandomCodeStr(length int) string
- func GenRandomStr(length int) string
- func Int64ToStr(i int64) string
- func LoadFile(fileFullPath string) []byte
- func PKCS7UnPadding(plantText []byte) ([]byte, error)
- func ParseZoneTime(input string) (time.Time, error)
- func RandStr(length int) string
- func StrToInt64(str string) (int64, error)
- func VerifyCallback(w http.ResponseWriter, r *http.Request) bool
- type CallbackParam
- type ConfigStruct
- type DataBox
- type EscapeError
- type FetchObjsByKeysRetMapFunc
- type InvalidHostError
- type OssBucket
- func (bucket *OssBucket) DeleteOssRes(resourcePath string) bool
- func (bucket *OssBucket) GetPolicyToken(tokenExpireTime int64) string
- func (bucket *OssBucket) SetOption(resourcePath string, option *OssOption) bool
- func (bucket *OssBucket) UploadToOss(resourcePath string, contentType string, reader io.Reader) bool
- type OssOption
- type PolicyToken
- type WxBizDataCrypt
Constants ¶
const LetterArray = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
const LetterArrayCode = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678"
const LetterArrayCodeLen = len(LetterArrayCode)
const LetterArrayLen = len(LetterArray)
Variables ¶
var OneDay, _ = time.ParseDuration("24h")
Functions ¶
func AddDateByDayNum ¶
func Base64Decode ¶
func Base64Encode ¶
func Capitalize ¶
func GenRandomCodeStr ¶
func GenRandomStr ¶
func Int64ToStr ¶
func PKCS7UnPadding ¶
PKCS7UnPadding return unpadding []Byte plantText
func StrToInt64 ¶
func VerifyCallback ¶
func VerifyCallback(w http.ResponseWriter, r *http.Request) bool
客户端直传后,OSS的回调函数中调用该函数进行参数验证。这里都把返回值写入了http.ResponseWriter中
Types ¶
type CallbackParam ¶
type ConfigStruct ¶
type DataBox ¶
type DataBox struct {
// contains filtered or unexported fields
}
func NewDataBox ¶
func NewDataBox(data interface{}) *DataBox
功能:生成NewDataBox对象,以便向data(必须是slice)中的成员(slice中的成员)添加指定数据,数据由FetchObjsByKeysRetMapFunc或者 FetchObjsByKeysRetSliceFunc返回slice中的对象和map中的value可以是结构或者是结构的指针 keyFieldName指明后续获取数据的key,后续会收集所有的key,传到FetchObjs...函数,以便集中化获取数据,提升效率 通过SaveToField函数指明的fieldname,得到数据填充的位置 其它特点: 1. 可以回填对象或者对象Slice 2. 可以多重填充 3. 被填充对象为指针,填充对象为结构对象 这种情况会导致异常
func (*DataBox) JoinByMap ¶
func (d *DataBox) JoinByMap(f FetchObjsByKeysRetMapFunc) *DataBox
func (*DataBox) SaveToField ¶
type EscapeError ¶
type EscapeError string
func (EscapeError) Error ¶
func (e EscapeError) Error() string
type FetchObjsByKeysRetMapFunc ¶
type FetchObjsByKeysRetMapFunc func(keyList interface{}) (key2ObjsMap interface{}) // map[key][]obj or map[key]obj or map[key][]*obj or map[key]*obj
用户需要实现的函数:通过key列表来获取对象,用于JoinByMap key列表时data里面通过keyfield抽取的key列表 第一个返回的map的key为传入的key;map里面的value可以是查到的单个对象,也可以是一个可以对应的对象slice 与FetchObjsByKeysRetSliceFunc相比,性能更高,且子结构可以不带父对象的ID,缺点是需要多写点代码
type InvalidHostError ¶
type InvalidHostError string
func (InvalidHostError) Error ¶
func (e InvalidHostError) Error() string
type OssBucket ¶
type OssBucket struct {
// contains filtered or unexported fields
}
func InitOssBucket ¶
func InitOssBucket(endPoint, accessKeyID, accessKeySecret, bucketName string, clientCacheTime int, callbackUrl, uploadDir string, tokenExpireTime int64) (*OssBucket, error)
endPoint, accessKeyID, accessKeySecret, bucketName string, clientCacheTime 为基础配置 callbackUrl uploadDir tokenExpireTime为客户端上传时的配置,callbackUrl为上传到oss的回调地址,uploadDir为上传的目录,tokenExpireTime为临时token的过期时间
func (*OssBucket) DeleteOssRes ¶
func (*OssBucket) GetPolicyToken ¶
获取客户端直传签名 客户端直传文档:https://help.aliyun.com/document_detail/31925.html, go demo:https://help.aliyun.com/document_detail/91818.html?spm=a2c4g.11186623.2.18.6ff36e28eGmN06#concept-mhj-zzt-2fb
type PolicyToken ¶
type WxBizDataCrypt ¶
WxBizDataCrypt represents an active WxBizDataCrypt object