Documentation ¶
Index ¶
- Variables
- func DeleteNote(db *gorm.DB, note *Note) error
- func DeleteUser(db *gorm.DB, user *User) (err error)
- func Execute(db *gorm.DB, body io.ReadCloser, code, user uuid.UUID) error
- func Login(db *gorm.DB, mail, pass string) (map[string]interface{}, error)
- func NewCode(db *gorm.DB, action int, userID uuid.UUID) (uuid.UUID, error)
- func ToggleNote(db *gorm.DB, note *Note) (map[string]interface{}, error)
- func UpdateNote(db *gorm.DB, note *Note) (map[string]interface{}, error)
- func UpdatePassword(db *gorm.DB, user *User) (err error)
- func UpdateUser(db *gorm.DB, user *User) (map[string]interface{}, error)
- type Base
- type Code
- type Note
- type Token
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var Actions = map[string]int{
"reset": 0,
}
Actions holds constants for different token types
Functions ¶
func DeleteUser ¶
DeleteUser removes a user from the database
func ToggleNote ¶
ToggleNote updates a note
func UpdateNote ¶
UpdateNote updates a note
func UpdatePassword ¶
UpdatePassword hashes and updates provided password
Types ¶
type Base ¶
type Base struct { ID uuid.UUID `gorm:"type:uuid;primary_key;"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"update_at"` DeletedAt *time.Time `sql:"index" json:"deleted_at"` }
Base contains common columns for all tables.
type Code ¶
type Code struct { Ticket uuid.UUID `json:"ticket"` UserID uuid.UUID `json:"userid"` Expiry time.Time `json:"expiry"` Action int `json:"action"` }
Code represents a one time voucher provided to user in certain circumstances
type Note ¶
type Note struct { Base Subject string `json:"subject"` Content string `json:"content"` Visible bool `gorm:"default:true" json:"visible"` Creator uuid.UUID `gorm:"type:uuid" json:"creator"` }
Note struct represents a note
func GetNote ¶
GetNote returns a single note, if present, that matches provided criteria and has visible == true
func GetNotesFor ¶
GetNotesFor returns an array of notes created by a specific user
type User ¶
type User struct { Base Name string `json:"name"` Mail string `json:"mail"` Pass string `json:"pass"` Auth string `sql:"-" json:"auth"` }
User is a struct to rep user
func GetUserByMail ¶
GetUserByMail fetches the user from db
Click to show internal directories.
Click to hide internal directories.