Documentation ¶
Index ¶
- Variables
- func DbCtx(ctx context.Context, tx *gorm.DB) context.Context
- func DbFromCtx(ctx context.Context) *gorm.DB
- func InitDatabase()
- func InitLogging() (_ *zap.Logger, err error)
- func IsDev() bool
- func IsProd() bool
- func MustTokenUserCtx(c fiber.Ctx) context.Context
- func SetTokenUser(tokenUser *TokenUser, c fiber.Ctx)
- func Transaction[T any](trans func(*gorm.DB) (*T, error)) (*T, error)
- type AppConfig
- type AuthenticationClaims
- type AuthenticationConfig
- type ContextDBKey
- type CorsConfig
- type DBConfig
- type JwtConfig
- type RedisConfig
- type ServerConfig
- type TokenUser
- type TokenUserKey
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DB *gorm.DB
)
View Source
var (
LOG *zap.Logger
)
Functions ¶
func InitDatabase ¶
func InitDatabase()
func InitLogging ¶
func MustTokenUserCtx ¶
func SetTokenUser ¶
func SetTokenUser(tokenUser *TokenUser, c fiber.Ctx)
Types ¶
type AppConfig ¶
type AppConfig struct { Server *ServerConfig DB *DBConfig Auth *AuthenticationConfig Redis *RedisConfig }
var (
CONF *AppConfig
)
type AuthenticationClaims ¶
type AuthenticationClaims struct { TokenUser jwt.RegisteredClaims }
type AuthenticationConfig ¶
type ContextDBKey ¶
type ContextDBKey struct{}
type CorsConfig ¶
type ServerConfig ¶
type ServerConfig struct { // Name string Port uint16 PathPrefix string `yaml:"pathPrefix"` Cors CorsConfig }
type TokenUser ¶
type TokenUser struct {
UserId uint
}
func GetTokenUser ¶
func MustTokenUser ¶
func MustTokenUser(c fiber.Ctx) *TokenUser
func MustTokenUserFromCtx ¶
type TokenUserKey ¶
type TokenUserKey struct{}
Click to show internal directories.
Click to hide internal directories.