controllers

package
v0.0.0-...-a25ac86 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteUserFromSession

func DeleteUserFromSession(ctx *fiber.Ctx, sessionStore *session.Store) error

Helper function to delete the user from the session

func GetUserFromSession

func GetUserFromSession(ctx *fiber.Ctx, sessionStore *session.Store) (uint, error)

Helper function to get the user from the session, if the user is not logged in, an error is returned.

func RenderTempl

func RenderTempl(c *fiber.Ctx, component templ.Component, options ...func(*templ.ComponentHandler)) error

func SetUserInSession

func SetUserInSession(ctx *fiber.Ctx, sessionStore *session.Store, userID uint) error

Helper function to set the user in the session

Types

type AuthController

type AuthController struct {
	Database      *gorm.DB
	SessionStore  *session.Store
	Environment   *env.Env
	MailjetClient *mailjet.Client
}

func (*AuthController) RegisterRoutes

func (ctrl *AuthController) RegisterRoutes(app *fiber.App)

RegisterRoutes registers the auth-related routes

type CompleteResourceController

type CompleteResourceController interface {
	// contains filtered or unexported methods
}

CompleteResourceController is an interface that defines the methods that a controller must implement

type HelloController

type HelloController struct{}

func (*HelloController) RegisterRoutes

func (ctrl *HelloController) RegisterRoutes(app *fiber.App)

type OrdersController

type OrdersController struct {
	Database     *gorm.DB
	SessionStore *session.Store
	Environment  *env.Env
}

func (*OrdersController) RegisterRoutes

func (ctrl *OrdersController) RegisterRoutes(app *fiber.App)

type PostsController

type PostsController struct {
	Database     *gorm.DB
	SessionStore *session.Store

} // Implements RouteRegistrar and CoreHandler

func (*PostsController) RegisterRoutes

func (ctrl *PostsController) RegisterRoutes(app *fiber.App)

type RouteRegistrar

type RouteRegistrar interface {
	RegisterRoutes(app *fiber.App)
}

RouteRegistrar is an interface that defines the method that a route registrar must implement

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL