service

package
v0.0.0-...-cc16a2d Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

type AuthService struct {
	CookieName   string
	SecureCookie *securecookie.SecureCookie
}

AuthService assists with authentication and authorization

func (*AuthService) ClearCookie

func (s *AuthService) ClearCookie(c echo.Context) error

ClearCookie erases the cookie

func (*AuthService) ExtractDataFromCookie

func (s *AuthService) ExtractDataFromCookie(c echo.Context) error

ExtractDataFromCookie puts data from the cookie into the context

func (*AuthService) IsAuthenticated

func (s *AuthService) IsAuthenticated(c echo.Context) bool

IsAuthenticated returns true if there is an authenticated user in the context

func (*AuthService) StoreUsernameInCookie

func (s *AuthService) StoreUsernameInCookie(c echo.Context, username string) error

StoreUsernameInCookie stores the username in the cookie

type LinkModel

type LinkModel struct {
	ID         int64     `db:"id"`
	FromPageID int64     `db:"from_page_id"`
	ToPageID   int64     `db:"to_page_id"`
	Created    time.Time `db:"created"`
	Updated    time.Time `db:"updated"`
}

LinkModel represents a link in the DB

type LinkService

type LinkService struct {
	DB *sqlx.DB
}

LinkService is a page service

func (s *LinkService) AddLink(fromPageID int64, toPageID int64) error

AddLink adds a link to the DB

func (*LinkService) DeleteByFromPageID

func (s *LinkService) DeleteByFromPageID(fromPageID int64) error

DeleteByFromPageID removes links from the DB

type PageAddressInfo

type PageAddressInfo struct {
	Name        string
	EscapedName string
}

PageAddressInfo represents a page info

type PageModel

type PageModel struct {
	ID      int64     `db:"id"`
	Name    string    `db:"name"`
	Content string    `db:"content"`
	Created time.Time `db:"created"`
	Updated time.Time `db:"updated"`
}

PageModel represents a page in the DB

type PageService

type PageService struct {
	DB          *sqlx.DB
	LinkService *LinkService
	SiteName    string
}

PageService is a page service

func (*PageService) Create

func (s *PageService) Create(p *PageModel) error

Create a page in the DB

func (*PageService) GenerateHTML

func (s *PageService) GenerateHTML(p *PageModel) string

GenerateHTML generates the HTML content for the page

func (*PageService) Get

func (s *PageService) Get(key int64) (*PageModel, error)

Get one page

func (*PageService) GetByName

func (s *PageService) GetByName(name string) (*PageModel, error)

GetByName gets one page by name

func (*PageService) GetLinkedPageAddressInfosByFromPageID

func (s *PageService) GetLinkedPageAddressInfosByFromPageID(fromPageID int64) ([]*PageAddressInfo, error)

GetLinkedPageAddressInfosByFromPageID gets from DB

func (*PageService) GetLinkedPageAddressInfosByToPageID

func (s *PageService) GetLinkedPageAddressInfosByToPageID(toPageID int64) ([]*PageAddressInfo, error)

GetLinkedPageAddressInfosByToPageID gets from DB

func (*PageService) GetOrphanedPageAddressInfos

func (s *PageService) GetOrphanedPageAddressInfos(limit int) ([]*PageAddressInfo, error)

GetOrphanedPageAddressInfos gets page infos for orphaned pages

func (*PageService) GetRecentlyUpdatedPageAddressInfos

func (s *PageService) GetRecentlyUpdatedPageAddressInfos(limit int) ([]*PageAddressInfo, error)

GetRecentlyUpdatedPageAddressInfos get recently updated page names

func (s *PageService) RegeneratePageLinks(p *PageModel) error

RegeneratePageLinks regenerates all links for this page

func (*PageService) Update

func (s *PageService) Update(p *PageModel) error

Update a page in the DB

Jump to

Keyboard shortcuts

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