server

package
v0.0.0-...-80e8cda Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheKeyPinnedJobs       = "pinnedJobs"
	CacheKeyNewJobsLastWeek  = "newJobsLastWeek"
	CacheKeyNewJobsLastMonth = "newJobsLastMonth"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Conn *sql.DB

	SessionStore *sessions.CookieStore
	// contains filtered or unexported fields
}

func NewServer

func NewServer(
	cfg config.Config,
	conn *sql.DB,
	r *mux.Router,
	t *template.Template,
	emailClient email.Client,
	sessionStore *sessions.CookieStore,
) Server

func (Server) CacheDelete

func (s Server) CacheDelete(key string) error

func (Server) CacheGet

func (s Server) CacheGet(key string) ([]byte, bool)

func (Server) CacheSet

func (s Server) CacheSet(key string, val []byte) error

func (Server) GetConfig

func (s Server) GetConfig() config.Config

func (Server) GetEmail

func (s Server) GetEmail() email.Client

func (Server) GetJWTSigningKey

func (s Server) GetJWTSigningKey() []byte

func (Server) IsEmail

func (s Server) IsEmail(val string) bool

func (Server) JSEscapeString

func (s Server) JSEscapeString(str string) string

func (Server) JSON

func (s Server) JSON(w http.ResponseWriter, status int, data interface{})

func (Server) Log

func (s Server) Log(err error, msg string)

func (Server) MEDIA

func (s Server) MEDIA(w http.ResponseWriter, status int, media []byte, mediaType string)

func (Server) MarkdownToHTML

func (s Server) MarkdownToHTML(str string) stdtemplate.HTML

func (Server) Redirect

func (s Server) Redirect(w http.ResponseWriter, r *http.Request, status int, dst string)

func (Server) RegisterPathPrefix

func (s Server) RegisterPathPrefix(path string, handler http.Handler, methods []string)

func (Server) RegisterRoute

func (s Server) RegisterRoute(path string, handler func(w http.ResponseWriter, r *http.Request), methods []string)

func (Server) Render

func (s Server) Render(r *http.Request, w http.ResponseWriter, status int, htmlView string, data interface{}) error

func (Server) RenderPageForCompanies

func (s Server) RenderPageForCompanies(w http.ResponseWriter, r *http.Request, companyRepo *company.Repository, jobRepo *job.Repository, devRepo *developer.Repository, location, page, htmlView string)

func (Server) RenderPageForDevelopers

func (s Server) RenderPageForDevelopers(w http.ResponseWriter, r *http.Request, devRepo *developer.Repository, location, tag, page, htmlView string)

func (Server) RenderPageForLocationAndTag

func (s Server) RenderPageForLocationAndTag(w http.ResponseWriter, r *http.Request, jobRepo *job.Repository, devRepo *developer.Repository, bookmarkRepo *bookmark.Repository, location, tag, page, salary, currency, htmlView string)

func (Server) RenderPageForLocationAndTagAdmin

func (s Server) RenderPageForLocationAndTagAdmin(r *http.Request, w http.ResponseWriter, jobRepo *job.Repository, location, tag, page, salary, currency, htmlView string)

func (Server) RenderPageForProfileRegistration

func (s Server) RenderPageForProfileRegistration(w http.ResponseWriter, r *http.Request, devRepo *developer.Repository, htmlView string)

func (Server) RenderPostAJobForLocation

func (s Server) RenderPostAJobForLocation(w http.ResponseWriter, r *http.Request, companyRepo *company.Repository, jobRepo *job.Repository, location string)

func (Server) RenderSalaryForLocation

func (s Server) RenderSalaryForLocation(w http.ResponseWriter, r *http.Request, jobRepo *job.Repository, devRepo *developer.Repository, location string)

func (Server) Run

func (s Server) Run() error

func (Server) SeenSince

func (s Server) SeenSince(r *http.Request, timeAgo time.Duration) bool

func (Server) StringToHTML

func (s Server) StringToHTML(str string) stdtemplate.HTML

func (Server) TEXT

func (s Server) TEXT(w http.ResponseWriter, status int, text string)

func (Server) XML

func (s Server) XML(w http.ResponseWriter, status int, data []byte)

Jump to

Keyboard shortcuts

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