Documentation
¶
Index ¶
- Variables
- func BoolToString(b bool) string
- func CapitalizeASCII(s string) string
- func CopyFile(src string, dest string) error
- func FileExists(name string) bool
- func FormatAvatarURL(uid int64, avatar string) string
- func FormatLike(s string) string
- func GetMemStats() *runtime.MemStats
- func GetURL(url string) ([]byte, error)
- func Int64Ptr(n int64) *int64
- func LogCtx(ctx context.Context) *logrus.Entry
- func NewBucketLimiter(d time.Duration, capacity int) (chan bool, *time.Ticker)
- func NilTime(t *time.Time) time.Time
- func RequestID(ctx context.Context) string
- func RequestType(ctx context.Context) string
- func Scope(ctx context.Context) string
- func SizeToString(size int64) string
- func SplitMultilineText(s *string) []string
- func StrPtr(s string) *string
- func Unpointify(s *string) string
- func UnsetCookie(w http.ResponseWriter, name string)
- func UploadMultipartFile(ctx context.Context, url string, f io.Reader, filename string) ([]byte, error)
- func UserID(ctx context.Context) int64
- func WriteTarball(w io.Writer, filePaths []string) error
- type CookieCutter
- type RandomStringer
- type RealRandomString
- type ValueOnlyContext
Constants ¶
This section is empty.
Variables ¶
View Source
var Cookies = cookies{
Login: "login",
}
Cookies is cookie name enum
View Source
var CtxKeys = ctxKeys{
UserID: "userID",
Log: "Log",
RequestID: "requestID",
RequestType: "requestType",
Scope: "scope",
}
CtxKeys is context value keys
View Source
var MetadataMutex sync.Mutex
Functions ¶
func BoolToString ¶
func CapitalizeASCII ¶
func FileExists ¶
func FormatAvatarURL ¶
func FormatLike ¶
func GetMemStats ¶
func NewBucketLimiter ¶
NewBucketLimiter creates a ticker channel that fills a bucket with one token every d and has a given capacity for burst usage
func RequestType ¶
RequestType extracts requestID from context
func SizeToString ¶
Convert size in bytes (123456789B) to a human readable string (Extensions B through EB)
func SplitMultilineText ¶
func UploadMultipartFile ¶
Types ¶
type CookieCutter ¶
type CookieCutter struct { Previous *securecookie.SecureCookie Current *securecookie.SecureCookie }
CookieCutter is the cookie handler
func (*CookieCutter) GetSecureCookie ¶
GetSecureCookie gets cookie
func (*CookieCutter) SetSecureCookie ¶
func (cc *CookieCutter) SetSecureCookie(w http.ResponseWriter, name string, value map[string]string, maxAge int) error
SetSecureCookie sets cookie
type RandomStringer ¶
type RealRandomString ¶
type RealRandomString struct {
// contains filtered or unexported fields
}
func NewRealRandomStringProvider ¶
func NewRealRandomStringProvider() *RealRandomString
func (*RealRandomString) RandomString ¶
func (r *RealRandomString) RandomString(n int) string
type ValueOnlyContext ¶
func (ValueOnlyContext) Done ¶
func (ValueOnlyContext) Done() <-chan struct{}
func (ValueOnlyContext) Err ¶
func (ValueOnlyContext) Err() error
Click to show internal directories.
Click to hide internal directories.