Documentation
¶
Index ¶
- type DB
- type Note
- type NoteManager
- type Project
- type ProjectManager
- type User
- type UserManager
- func (state *UserManager) AddUser(username, password, email string) *User
- func (state *UserManager) CheckPassword(hashedPassword, password string) bool
- func (state *UserManager) FindUser(username string) *User
- func (state *UserManager) FindUserByAccessToken(token string) (*gorm.DB, *User)
- func (state *UserManager) FindUserByUUID(uuid string) *User
- func (state *UserManager) HasUser(username string) bool
- func (state *UserManager) HasUserWithEmail(email string) bool
- func (state *UserManager) HashPassword(username, password string) string
- func (state *UserManager) UpdateUser(user *User) *User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Note ¶
type Note struct {
gorm.Model
ProjectID uint
Name string `gorm:"not null;unique_index" json:"name"`
Active bool `gorm:"default:true" json:"active"`
}
Note struct
type NoteManager ¶
type NoteManager struct {
// contains filtered or unexported fields
}
NoteManager struct
type Project ¶
type Project struct {
gorm.Model
Notes []Note
Name string `gorm:"not null;unique_index" json:"name"`
Active bool `gorm:"default:true" json:"active"`
Tags pq.StringArray `gorm:"type:varchar(64)[]"`
}
Project struct
type ProjectManager ¶
type ProjectManager struct {
// contains filtered or unexported fields
}
ProjectManager struct
func NewProjectManager ¶
func NewProjectManager(db *DB) (*ProjectManager, error)
func (*ProjectManager) AddProject ¶
func (state *ProjectManager) AddProject(name string) *Project
func (*ProjectManager) FindProjects ¶
func (state *ProjectManager) FindProjects() []Project
type User ¶
type User struct {
gorm.Model
Username string `gorm:"not null;unique_index" json:"username"`
Email string `gorm:"type:varchar(100);unique_index" json:"email"`
Password string `gorm:"not null" json:"-"`
APIToken string `gorm:"not null;unique_index" json:"apiToken"`
UUID string `gorm:"not null;unique_index" json:"uuid"`
}
User struct
type UserManager ¶
type UserManager struct {
// contains filtered or unexported fields
}
UserManager struct
func NewUserManager ¶
func NewUserManager(db *DB) (*UserManager, error)
NewUserManager - Create a new *UserManager that can be used for managing users.
func (*UserManager) AddUser ¶
func (state *UserManager) AddUser(username, password, email string) *User
AddUser - Creates a user and hashes the password
func (*UserManager) CheckPassword ¶
func (state *UserManager) CheckPassword(hashedPassword, password string) bool
CheckPassword - compare a hashed password with a possible plaintext equivalent
func (*UserManager) FindUserByAccessToken ¶
func (state *UserManager) FindUserByAccessToken(token string) (*gorm.DB, *User)
FindUserByAccessToken -
func (*UserManager) FindUserByUUID ¶
func (state *UserManager) FindUserByUUID(uuid string) *User
FindUserByUUID -
func (*UserManager) HasUser ¶
func (state *UserManager) HasUser(username string) bool
HasUser - Check if the given username exists.
func (*UserManager) HasUserWithEmail ¶
func (state *UserManager) HasUserWithEmail(email string) bool
HasUserWithEmail - Check if the given username exists.
func (*UserManager) HashPassword ¶
func (state *UserManager) HashPassword(username, password string) string
HashPassword - Hash the password (takes a username as well, it can be used for salting).
func (*UserManager) UpdateUser ¶
func (state *UserManager) UpdateUser(user *User) *User
UpdateUser - Saves the provided *User
Click to show internal directories.
Click to hide internal directories.