Documentation
¶
Index ¶
- Variables
- func ContentType(t string, w http.ResponseWriter, r *http.Request) bool
- func DeleteWallHandler(db *Store, security Auth, walls *Walls) http.HandlerFunc
- func Deserialize(v []byte, e interface{}) error
- func GetWallHandler(db *Store, security Auth, walls *Walls) http.HandlerFunc
- func LoadTestUser(db *Store, users CreateUser)
- func Logout(sessionManager *scs.SessionManager) http.HandlerFunc
- func PatchWallHandler(security Auth) http.HandlerFunc
- func PostForgotPassword(db *Store, users FindUserByEmail) http.HandlerFunc
- func PostLogin(db *Store, users FindUserByEmail, registrations FindRegistrationByEmail, ...) http.HandlerFunc
- func PostRegistration(db *Store, registrations CreateRegistration, users FindUserByEmail, ...) http.HandlerFunc
- func PostResetPassword(db *Store, users FindUserByEmail) http.HandlerFunc
- func PostVerifyEmail(db *Store, registrations FindRegistrationByID, users CreateUser) http.HandlerFunc
- func PostWallHandler(db *Store, security Auth, walls *Walls) http.HandlerFunc
- func RebuildSearchIndex()
- func RenderTemplate(name string) http.HandlerFunc
- func Serialize(e interface{}) ([]byte, error)
- func StartServer()
- func WallCollab(conf CollabConfig, db *Store, walls interface{ ... }) http.HandlerFunc
- func WallMapping(index *mapping.IndexMappingImpl)
- type Action
- type CollabConfig
- type Collaborator
- type Collective
- type Config
- type CreateRegistration
- type CreateSession
- type CreateUser
- type CreateWall
- type DeleteUser
- type DeleteWall
- type Email
- type EmailClient
- type EmailConfig
- type EmailForm
- type Error
- type ErrorResult
- type FindRegistrationByEmail
- type FindRegistrationByID
- type FindUserByEmail
- type FindUserById
- type FindWallById
- type ForgotPasswordForm
- type Index
- type JsonResult
- type Key
- type LogConfig
- type LoginForm
- type Node
- type Object
- type Password
- type PasswordForm
- type PasswordHash
- type Pool
- type RawResult
- type Readable
- type Registration
- type RegistrationForm
- type RegistrationService
- type Registrations
- type Request
- type Response
- type Result
- type Result2
- type SendEmail
- type SendMailFunc
- type ServerConfig
- type Session
- type Sessions
- type State
- type Store
- type StoreConfig
- type Token
- type Txn
- type UpdateWall
- type User
- type UserService
- type Users
- type Verification
- type Wall
- type Walls
- type Writable
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EmailErr = errors.New("invalid email") PasswordErr = errors.New("invalid password") )
View Source
var DuplicateEmailErr = errors.New("duplicate email")
View Source
var ErrScheduleTimeout = fmt.Errorf("schedule error: timed out")
View Source
var (
ErrWallTitleEmpty = errors.New("wall title empty")
)
Functions ¶
func ContentType ¶
func DeleteWallHandler ¶
func DeleteWallHandler(db *Store, security Auth, walls *Walls) http.HandlerFunc
func Deserialize ¶
func GetWallHandler ¶
func GetWallHandler(db *Store, security Auth, walls *Walls) http.HandlerFunc
func LoadTestUser ¶
func LoadTestUser(db *Store, users CreateUser)
func Logout ¶
func Logout(sessionManager *scs.SessionManager) http.HandlerFunc
func PatchWallHandler ¶
func PatchWallHandler(security Auth) http.HandlerFunc
func PostForgotPassword ¶
func PostForgotPassword(db *Store, users FindUserByEmail) http.HandlerFunc
func PostLogin ¶
func PostLogin(db *Store, users FindUserByEmail, registrations FindRegistrationByEmail, sessionManager *scs.SessionManager, emails SendEmail) http.HandlerFunc
func PostRegistration ¶
func PostRegistration(db *Store, registrations CreateRegistration, users FindUserByEmail, emails SendEmail) http.HandlerFunc
func PostResetPassword ¶
func PostResetPassword(db *Store, users FindUserByEmail) http.HandlerFunc
func PostVerifyEmail ¶
func PostVerifyEmail(db *Store, registrations FindRegistrationByID, users CreateUser) http.HandlerFunc
func PostWallHandler ¶
func PostWallHandler(db *Store, security Auth, walls *Walls) http.HandlerFunc
func RebuildSearchIndex ¶
func RebuildSearchIndex()
func RenderTemplate ¶
func RenderTemplate(name string) http.HandlerFunc
func StartServer ¶
func StartServer()
func WallCollab ¶
func WallCollab(conf CollabConfig, db *Store, walls interface { FindWallById UpdateWall }) http.HandlerFunc
func WallMapping ¶
func WallMapping(index *mapping.IndexMappingImpl)
Types ¶
type Action ¶
type CollabConfig ¶
type Collaborator ¶
type Collaborator struct {
// contains filtered or unexported fields
}
func (*Collaborator) Receive ¶
func (u *Collaborator) Receive() error
Receive reads next message from user's underlying connection. It blocks until full message received.
type Collective ¶
type Collective struct {
// contains filtered or unexported fields
}
Chat contains logic of user interaction.
func NewChat ¶
func NewChat(pool *Pool) *Collective
func (*Collective) Broadcast ¶
func (c *Collective) Broadcast(method string, params Object) error
Broadcast sends message to all alive users.
func (*Collective) Register ¶
func (c *Collective) Register(conn net.Conn) *Collaborator
Register registers new connection as a User.
func (*Collective) Remove ¶
func (c *Collective) Remove(user *Collaborator)
Remove removes user from chat.
func (*Collective) Rename ¶
func (c *Collective) Rename(user *Collaborator, name string) (prev string, ok bool)
Rename renames user.
type Config ¶
type Config struct { Debug bool Store StoreConfig Server ServerConfig Email EmailConfig }
type CreateRegistration ¶
type CreateRegistration interface {
CreateRegistration(*Txn, Email, Password) (*Registration, error)
}
type CreateUser ¶
type DeleteUser ¶
type DeleteWall ¶
type EmailClient ¶
type EmailClient struct { Conf EmailConfig SendMail SendMailFunc Templates map[string]template.Template }
type EmailConfig ¶
type ErrorResult ¶
type ErrorResult struct {
Message string
}
type FindRegistrationByEmail ¶
type FindRegistrationByEmail interface {
FindRegistrationByEmail(*Txn, Email) (*Registration, error)
}
type FindRegistrationByID ¶
type FindRegistrationByID interface {
FindRegistrationByID(*Txn, Token) (*Registration, error)
}
type FindUserByEmail ¶
type ForgotPasswordForm ¶
type ForgotPasswordForm struct {
Email Email `json:"email"`
}
type JsonResult ¶
type JsonResult struct{}
type Password ¶
type Password string
func (Password) HashPassword ¶
func (p Password) HashPassword() (PasswordHash, error)
type PasswordForm ¶
type PasswordForm struct {
Password Password
}
type PasswordHash ¶
type PasswordHash []byte
func (PasswordHash) ComparePassword ¶
func (h PasswordHash) ComparePassword(p Password) error
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func NewPool ¶
NewPool creates new goroutine pool with given size. It also creates a work queue of given size. Finally, it spawns given amount of goroutines immediately. Make pool of X size, Y sized work queue and one pre-spawned goroutine.
type Registration ¶
type Registration struct { ID Token Email Email PasswordHash PasswordHash CreatedAt time.Time VerifiedAt *time.Time }
func (*Registration) Deserialize ¶
func (r *Registration) Deserialize(b []byte) error
func (*Registration) Key ¶
func (r *Registration) Key() Key
func (*Registration) Serialize ¶
func (r *Registration) Serialize() ([]byte, error)
type RegistrationForm ¶
func (RegistrationForm) Validate ¶
func (f RegistrationForm) Validate() error
type RegistrationService ¶
type RegistrationService interface { CreateUser FindRegistrationByID FindRegistrationByEmail }
type Registrations ¶
type Registrations struct{ DB *Store }
func (Registrations) CreateRegistration ¶
func (s Registrations) CreateRegistration(txn *Txn, email Email, password Password) (*Registration, error)
func (Registrations) FindRegistrationByEmail ¶
func (s Registrations) FindRegistrationByEmail(*Txn, Email) (*Registration, error)
func (Registrations) FindRegistrationByID ¶
func (s Registrations) FindRegistrationByID(*Txn, Token) (*Registration, error)
type ServerConfig ¶
type ServerConfig struct {
Addr string
}
type State ¶
type StoreConfig ¶
type UpdateWall ¶
type User ¶
type User struct { ID xid.ID Email Email PasswordHash PasswordHash Name string Roles []Role }
func (*User) Deserialize ¶
type UserService ¶
type UserService interface { CreateUser DeleteUser FindUserById FindUserByEmail }
type Verification ¶
type Verification struct{ Token Token }
type Wall ¶
type Wall struct { ID xid.ID `json:"id"` Title string `json:"title"` Owner Key `json:"owner"` CreatedAt time.Time `json:"createdAt"` ModifiedAt time.Time `json:"modifiedAt"` AllowList []Key `json:"allowList"` Content []interface{} `json:"content"` }
func (*Wall) Deserialize ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.