init repo

This commit is contained in:
VaalaCat
2024-08-28 00:02:28 +08:00
committed by vaalacat
commit 13148b95e3
97 changed files with 10214 additions and 0 deletions

21
common/context.go Normal file
View File

@@ -0,0 +1,21 @@
package common
import (
"context"
"github.com/nose7en/ToyBoomServer/defs"
)
func GetUser(c context.Context) defs.UserGettable {
val := c.Value(UserInfoKey)
if val == nil {
return nil
}
u, ok := val.(defs.UserGettable)
if !ok {
return nil
}
return u
}