web

package
v0.0.0-...-5b0fdc6 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSessionManager

func NewSessionManager(dataSourceName string) (*scs.SessionManager, error)

Types

type CommentHandler

type CommentHandler struct {
	// contains filtered or unexported fields
}

func (*CommentHandler) Store

func (h *CommentHandler) Store() http.HandlerFunc

func (*CommentHandler) Vote

func (h *CommentHandler) Vote() http.HandlerFunc

type CreateCommentForm

type CreateCommentForm struct {
	Content string

	Errors FormErrors
}

func (*CreateCommentForm) Validate

func (f *CreateCommentForm) Validate() bool

type CreatePostForm

type CreatePostForm struct {
	Title   string
	Content string

	Errors FormErrors
}

func (*CreatePostForm) Validate

func (f *CreatePostForm) Validate() bool

type CreateThreadForm

type CreateThreadForm struct {
	Title       string
	Description string

	Errors FormErrors
}

func (*CreateThreadForm) Validate

func (f *CreateThreadForm) Validate() bool

type FormErrors

type FormErrors map[string]string

type Handler

type Handler struct {
	*chi.Mux
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(store godiscuss.Store, sessions *scs.SessionManager) *Handler

func (*Handler) Home

func (h *Handler) Home() http.HandlerFunc

type LoginForm

type LoginForm struct {
	Username             string
	Password             string
	IncorrectCredentials bool

	Errors FormErrors
}

func (*LoginForm) Validate

func (f *LoginForm) Validate() bool

type PostHandler

type PostHandler struct {
	// contains filtered or unexported fields
}

func (*PostHandler) Create

func (h *PostHandler) Create() http.HandlerFunc

To handle r.Get("/{id}/new", postHandler.Create())

func (*PostHandler) Show

func (h *PostHandler) Show() http.HandlerFunc

To handle r.Get("/{threadID}/{postID}", postHandler.Show())

func (*PostHandler) Store

func (h *PostHandler) Store() http.HandlerFunc

To handle r.Post("/{id}", postHandler.Store())

func (*PostHandler) Vote

func (h *PostHandler) Vote() http.HandlerFunc

To handle r.Get("/{threadID}/{postID}/vote", postHandler.Vote())

type RegisterForm

type RegisterForm struct {
	Username      string
	Password      string
	UsernameTaken bool

	Errors FormErrors
}

func (*RegisterForm) Validate

func (f *RegisterForm) Validate() bool

type SessionData

type SessionData struct {
	FlashMessage string
	Form         interface{}
	User         godiscuss.User
	LoggedIn     bool
}

func GetSessionData

func GetSessionData(session *scs.SessionManager, ctx context.Context) SessionData

type ThreadHandler

type ThreadHandler struct {
	// contains filtered or unexported fields
}

func (*ThreadHandler) Create

func (h *ThreadHandler) Create() http.HandlerFunc

func (*ThreadHandler) Delete

func (h *ThreadHandler) Delete() http.HandlerFunc

func (*ThreadHandler) List

func (h *ThreadHandler) List() http.HandlerFunc

func (*ThreadHandler) Show

func (h *ThreadHandler) Show() http.HandlerFunc

func (*ThreadHandler) Store

func (h *ThreadHandler) Store() http.HandlerFunc

type UserHandler

type UserHandler struct {
	// contains filtered or unexported fields
}

func (*UserHandler) Login

func (h *UserHandler) Login() http.HandlerFunc

To handle h.Get("/login", userHandler.Login())

func (*UserHandler) LoginSubmit

func (h *UserHandler) LoginSubmit() http.HandlerFunc

To handle h.Post("/login", userHandler.LoginSubmit())

func (*UserHandler) Logout

func (h *UserHandler) Logout() http.HandlerFunc

func (*UserHandler) Register

func (h *UserHandler) Register() http.HandlerFunc

To handle h.Get("/register", userHandler.Register())

func (*UserHandler) RegisterSubmit

func (h *UserHandler) RegisterSubmit() http.HandlerFunc

To handle h.Post("/register", userHandler.RegisterSubmit())

Jump to

Keyboard shortcuts

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