1 Star 0 Fork 0

h79 / gothird

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
access.go 685 Bytes
一键复制 编辑 原始数据 按行查看 历史
huqiuyun 提交于 2022-08-21 22:44 . init
package access
import (
"time"
)
// Nanosecond,纳秒
const refExpire = time.Hour * time.Duration(24*6)
// ExpireSecond
/**
* @param expire 秒
* @return Nanosecond,纳秒
*/
func ExpireSecond(expire int64) int64 {
return (time.Second * time.Duration(expire)).Nanoseconds()
}
// RefExpireSecond
/**
* @param expire 秒
* @return Nanosecond,纳秒
*/
func RefExpireSecond(expire int64) int64 {
ex := ExpireSecond(expire)
if ex == 0 {
ex = refExpire.Nanoseconds()
}
return ex
}
type Value struct {
Data string
ExpireIn int64
}
func (v Value) IsValidOf() bool {
return v.Data != ""
}
type Token interface {
GetAccessToken() Value
GetRefAccessToken() Value
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/h79/gothird.git
git@gitee.com:h79/gothird.git
h79
gothird
gothird
v1.0.54

搜索帮助

344bd9b3 5694891 D2dac590 5694891