Documentation ¶
Index ¶
- Constants
- Variables
- type Article
- type Config
- type ContextKey
- type Preference
- type PreferenceSelection
- type Revision
- type User
- type WikiModel
- func (model *WikiModel) CheckUserPassword(u *User) error
- func (model *WikiModel) DeleteCookie(r *http.Request, rw http.ResponseWriter, s *sessions.Session) error
- func (model *WikiModel) GetArticle(url string) (*Article, error)
- func (model *WikiModel) GetArticleByRevisionHash(url string, hash string) (*Article, error)
- func (model *WikiModel) GetArticleByRevisionID(url string, id int) (*Article, error)
- func (model *WikiModel) GetCookie(r *http.Request, name string) (*sessions.Session, error)
- func (model *WikiModel) GetPreference(key string) (*Preference, error)
- func (model *WikiModel) GetRevisionHistory(url string) ([]*Revision, error)
- func (model *WikiModel) GetUserByScreenName(screenname string) (*User, error)
- func (model *WikiModel) NewCookie(r *http.Request, name string) (*sessions.Session, error)
- func (model *WikiModel) PostArticle(article *Article) error
- func (model *WikiModel) PostUser(user *User) error
- func (model *WikiModel) PreviewMarkdown(markdown string) (string, error)
- func (model *WikiModel) Render(markdown string) (string, error)
- func (model *WikiModel) SaveCookie(r *http.Request, rw http.ResponseWriter, s *sessions.Session) error
- func (model *WikiModel) UpdatePreference(pref *Preference) error
Constants ¶
View Source
const ( IntPref = iota TextPref SelectionPref )
Variables ¶
View Source
var ErrArticleNotModified = errors.New("article not modified")
View Source
var ErrBadUsername = errors.New("username must only contain letters, numbers, -, or _")
View Source
var ErrEmailTaken = errors.New("email already in use")
View Source
var ErrEmptyUsername = errors.New("username cannot be empty")
View Source
var ErrGenericNotFound = errors.New("not found")
View Source
var ErrIncorrectPassword = errors.New("incorrect password")
View Source
var ErrPasswordTooShort = errors.New("password too short")
View Source
var ErrRevisionAlreadyExists = errors.New("revision already exists")
View Source
var ErrRevisionNotFound = errors.New("revision not found")
View Source
var ErrUsernameNotFound = errors.New("username not found")
View Source
var ErrUsernameTaken = errors.New("username already in use")
Functions ¶
This section is empty.
Types ¶
type Article ¶
func NewArticle ¶
type ContextKey ¶
type ContextKey string
const UserKey ContextKey = "periwiki.user"
UserKey is for context.Context
type Preference ¶
type Preference struct { ID int `db:"id"` Label string `db:"pref_label"` Type int `db:"pref_type"` HelpText sql.NullString `db:"help_text"` IntValue sql.NullInt64 `db:"pref_int"` TextValue sql.NullString `db:"pref_text"` SelectionValue sql.NullInt64 `db:"pref_selection"` SelectionChoices []*PreferenceSelection }
type PreferenceSelection ¶
type User ¶
type User struct { Email string `db:"email"` ScreenName string `db:"screenname"` ID int `db:"id"` PasswordHash string `db:"passwordhash"` RawPassword string IPAddress string }
func AnonymousUser ¶
func AnonymousUser() *User
func (*User) SetPasswordHash ¶
type WikiModel ¶
type WikiModel struct { *Config // contains filtered or unexported fields }
func (*WikiModel) CheckUserPassword ¶
func (*WikiModel) DeleteCookie ¶
func (model *WikiModel) DeleteCookie(r *http.Request, rw http.ResponseWriter, s *sessions.Session) error
DeleteCookie wraps gorilla/sessions.Store.Delete, as implemented by WikiModel.db
func (*WikiModel) GetArticleByRevisionHash ¶
func (*WikiModel) GetArticleByRevisionID ¶
func (*WikiModel) GetCookie ¶
GetCookie wraps gorilla/sessions.Store.Get, as implemented by WikiModel.db
func (*WikiModel) GetPreference ¶
func (model *WikiModel) GetPreference(key string) (*Preference, error)
func (*WikiModel) GetRevisionHistory ¶
func (*WikiModel) GetUserByScreenName ¶
func (*WikiModel) NewCookie ¶
NewCookie wraps gorilla/sessions.Store.New, as implemented by WikiModel.db
func (*WikiModel) PostArticle ¶
func (*WikiModel) PreviewMarkdown ¶
func (*WikiModel) SaveCookie ¶
func (model *WikiModel) SaveCookie(r *http.Request, rw http.ResponseWriter, s *sessions.Session) error
SaveCookie wraps gorilla/sessions.Store.Save, as implemented by WikiModel.db
func (*WikiModel) UpdatePreference ¶
func (model *WikiModel) UpdatePreference(pref *Preference) error
Click to show internal directories.
Click to hide internal directories.