controllers

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COOKIE_NAME             = "quizmaker-cookie"
	COOKIE_LIFETIME_SEC     = 3600
	COOKIE_TIMESTAMP_FORMAT = "2006-01-02 15:04:05"
)

Variables

View Source
var QuizNewQRImageMemoization map[string][]byte

Functions

func CreateCookie

func CreateCookie(email, userAgent string) (*http.Cookie, error)

func GetFullURL

func GetFullURL(request *http.Request, routeName string, params map[string]string) (string, error)

func GetRoutePath

func GetRoutePath(routeName string, params map[string]string) (string, error)

func Render

func Render(templates []string, w http.ResponseWriter, data interface{})

Render renders the given templates using the provided data and writes the result to the provided ResponseWriter.

func SetupRoutes

func SetupRoutes(e *gin.Engine, routes Routes)

Types

type CookieValue

type CookieValue struct {
	Email     string
	Timestamp string
	UserAgent string
}

type QuestionController

type QuestionController struct{}

func (*QuestionController) Answer

func (c *QuestionController) Answer(gctx *gin.Context)

type QuizController

type QuizController struct{}

func (*QuizController) Create

func (c *QuizController) Create(gctx *gin.Context)

func (*QuizController) New

func (c *QuizController) New(gctx *gin.Context)

func (*QuizController) Show

func (c *QuizController) Show(gctx *gin.Context)

type Route

type Route struct {
	Name    string
	Method  string
	Path    string
	Format  string
	Handler gin.HandlerFunc
}

Route describes a route for httprouter

func RouteByName

func RouteByName(name string) (Route, error)

type Routes

type Routes []Route

func GetRoutes

func GetRoutes() Routes

type SessionController added in v0.0.2

type SessionController struct{}

func (*SessionController) List added in v0.0.2

func (c *SessionController) List(gctx *gin.Context)

Jump to

Keyboard shortcuts

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