web

package
v0.0.0-...-2384305 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.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 CommentsHandler

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

func (*CommentsHandler) Store

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

func (*CommentsHandler) Vote

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

type CreateCommentForm

type CreateCommentForm struct {
	Content string
	Errors  FormErrors
}

func (*CreateCommentForm) Validate

func (f *CreateCommentForm) Validate() bool

Validate validates the comment form with Content

type CreatePostForm

type CreatePostForm struct {
	Title   string
	Content string
	Errors  FormErrors
}

func (*CreatePostForm) Validate

func (f *CreatePostForm) Validate() bool

Validate validates the post form with Title and Content

type CreateThreadForm

type CreateThreadForm struct {
	Title       string
	Description string
	Errors      FormErrors
}

func (*CreateThreadForm) Validate

func (f *CreateThreadForm) Validate() bool

Validate validates the thread form with Title and Description

type FormErrors

type FormErrors map[string]string

type Handler

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

func NewHandler

func NewHandler(store goreddit.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

Validate validates the user login form with Username and Password

type PostsHandler

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

func (*PostsHandler) Create

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

func (*PostsHandler) Show

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

func (*PostsHandler) Store

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

func (*PostsHandler) Vote

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

type RegisterForm

type RegisterForm struct {
	Username      string
	Password      string
	UsernameTaken bool
	Errors        FormErrors
}

func (*RegisterForm) Validate

func (f *RegisterForm) Validate() bool

Validate validates the user registration form with Username and Password

type SessionData

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

func GetSessionData

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

type ThreadsHandler

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

func (*ThreadsHandler) Create

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

func (*ThreadsHandler) Delete

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

func (*ThreadsHandler) List

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

func (*ThreadsHandler) Show

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

func (*ThreadsHandler) Store

func (h *ThreadsHandler) 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