web

package
v0.0.0-...-5308550 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSessionsManager

func NewSessionsManager(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 goddit.Store, sessions *scs.SessionManager, csrfKey []byte) *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

func (*PostHandler) Show

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

func (*PostHandler) Store

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

func (*PostHandler) Vote

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

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{}
}

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

func (*UserHandler) LoginSubmit

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

func (*UserHandler) Logout

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

func (*UserHandler) Register

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

func (*UserHandler) RegisterSubmit

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

Jump to

Keyboard shortcuts

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