Documentation
¶
Index ¶
- Constants
- Variables
- func AsString(v any) string
- func AssignOrDefault(value string, defaultValue string) string
- func BanUser(id int)
- func Bool(env string, defaultValue bool) bool
- func Bytes2Size(num int64) string
- func CalcElapsedTime(start time.Time) int64
- func DeDuplication(slice []string) []string
- func DeleteKey(key string, purpose string)
- func Done(c *gin.Context)
- func EmbedFolder(fsEmbed embed.FS, targetPath string) static.ServeFileSystem
- func Float64(env string, defaultValue float64) float64
- func Float64PtrMax(p *float64, maxValue float64) *float64
- func Float64PtrMin(p *float64, minValue float64) *float64
- func GenRequestID() string
- func GenerateKey() string
- func GenerateVerificationCode(length int) string
- func GetIp() (ip string)
- func GetRandomNumberString(length int) string
- func GetRandomString(length int) string
- func GetRequestBody(c *gin.Context) ([]byte, error)
- func GetRequestID(ctx context.Context) string
- func GetResponseID(c *gin.Context) string
- func GetTimeString() string
- func GetTimestamp() int64
- func GetUUID() string
- func Int(env string, defaultValue int) int
- func IntMax(a int, b int) int
- func Interface2String(inter interface{}) string
- func IsUserBanned(id int) bool
- func Max(a int, b int) int
- func MessageWithRequestId(message string, id string) string
- func ObjectData(c *gin.Context, object interface{}) error
- func OpenBrowser(url string)
- func Password2Hash(password string) (string, error)
- func RandRange(min, max int) int
- func RegisterVerificationCodeWithKey(key string, code string, purpose string)
- func SetEventStreamHeaders(c *gin.Context)
- func SetRequestID(ctx context.Context, id string) context.Context
- func String(env string, defaultValue string) string
- func String2Int(str string) int
- func StringData(c *gin.Context, str string)
- func UnbanUser(id int)
- func UnescapeHTML(x string) interface{}
- func UnmarshalBodyReusable(c *gin.Context, v any) error
- func ValidatePasswordAndHash(password string, hash string) bool
- func VerifyCodeWithKey(key string, code string, purpose string) bool
- type CustomEvent
- type InMemoryRateLimiter
Constants ¶
View Source
const ( EmailVerificationPurpose = "v" PasswordResetPurpose = "r" )
View Source
const (
RequestIdKey = "X-Oneapi-Request-Id"
)
Variables ¶
View Source
var Validate *validator.Validate
View Source
var VerificationValidMinutes = 10
Functions ¶
func AssignOrDefault ¶
func Bytes2Size ¶
func CalcElapsedTime ¶
CalcElapsedTime return the elapsed time in milliseconds (ms)
func DeDuplication ¶
func EmbedFolder ¶
func EmbedFolder(fsEmbed embed.FS, targetPath string) static.ServeFileSystem
func Float64PtrMax ¶
func Float64PtrMin ¶
func GenRequestID ¶
func GenRequestID() string
func GenerateKey ¶
func GenerateKey() string
func GetRandomNumberString ¶
func GetRandomString ¶
func GetRequestID ¶
func GetResponseID ¶
func GetTimeString ¶
func GetTimeString() string
func GetTimestamp ¶
func GetTimestamp() int64
func Interface2String ¶
func Interface2String(inter interface{}) string
func IsUserBanned ¶
func MessageWithRequestId ¶
func ObjectData ¶
func OpenBrowser ¶
func OpenBrowser(url string)
func Password2Hash ¶
func SetEventStreamHeaders ¶
func String2Int ¶
func StringData ¶
func UnescapeHTML ¶
func UnescapeHTML(x string) interface{}
func ValidatePasswordAndHash ¶
Types ¶
type CustomEvent ¶
func (CustomEvent) Render ¶
func (r CustomEvent) Render(w http.ResponseWriter) error
func (CustomEvent) WriteContentType ¶
func (r CustomEvent) WriteContentType(w http.ResponseWriter)
type InMemoryRateLimiter ¶
type InMemoryRateLimiter struct {
// contains filtered or unexported fields
}
func (*InMemoryRateLimiter) Init ¶
func (l *InMemoryRateLimiter) Init(expirationDuration time.Duration)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.