Documentation
¶
Index ¶
- func AddItem(name, url string, rank int) error
- func CreateUser(newUser *UserModel) error
- func DeleteItem(item *ItemModel) error
- func GetAllItems() (*[]ItemModel, error)
- func GetItems(condition interface{}, scopes ...func(*gorm.DB) *gorm.DB) (*[]ItemModel, error)
- func GetReservedItems(userID int) (*[]ItemModel, error)
- func GetWantedItems() (*[]ItemModel, error)
- func ItemDefaultScope(db *gorm.DB) *gorm.DB
- func ItemOrderScope(db *gorm.DB) *gorm.DB
- func ItemReserveScope(db *gorm.DB) *gorm.DB
- func UpdateItemWithMap(item *ItemModel, updates map[string]interface{}) error
- func UpdateUser(user *UserModel, updates UserModel) error
- func UpdateUserWithMap(user *UserModel, updates map[string]interface{}) error
- func UserAuthScope(db *gorm.DB) *gorm.DB
- func UserDefaultScope(db *gorm.DB) *gorm.DB
- func UserPassResetScope(db *gorm.DB) *gorm.DB
- type DefaultModel
- type ItemModel
- type UserModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateUser ¶
func DeleteItem ¶
func GetAllItems ¶
func GetReservedItems ¶
func GetWantedItems ¶
func UpdateItemWithMap ¶
func UpdateUser ¶
func UpdateUserWithMap ¶
UpdateUserWithMap will update an existing user. A map is needed instead of the UserModel when you want/need to insert NULL sql field values.
Types ¶
type DefaultModel ¶
type ItemModel ¶
type ItemModel struct { DefaultModel Name string `gorm:"column:name;type:varchar(255);not null"` URL string `gorm:"column:url;type:varchar(255);not null"` Reserved bool `gorm:"column:reserved;type:tinyint(1);not null;DEFAULT:false"` Reserver UserModel `gorm:"foreignkey:ReserverID"` ReserverID *int `gorm:"column:reserverid;type:integer;DEFAULT:NULL"` Rank int `gorm:"colunm:rank;type:integer;DEFAULT:NULL"` }
func FindOneItem ¶
type UserModel ¶
type UserModel struct { DefaultModel Username string `gorm:"column:username;type:varchar(255);unique;not null"` PasswordHash string `gorm:"column:hash;type:varchar(255);not null"` PasswordReset bool `gorm:"column:passwordreset;type:tinyint(1);not null;DEFAULT:false"` PasswordResetToken *string `gorm:"column:passwordResetToken;type:varchar(255);DEFAULT:NULL"` PasswordResetExpires *time.Time `gorm:"column:passwordResetExpires;type:DATETIME;DEFAULT:NULL"` UserLevel uint `gorm:"column:userlevel;type:tinyint unsigned;not null"` EMail string `gorm:"column:email;type:varchar(255);not null"` FirstName string `gorm:"column:firstname;type:varchar(255);not null"` LastName string `gorm:"column:lastname;type:varchar(255);not null"` ReservedItems []ItemModel `gorm:"foreignkey:ReserverID"` }
UserModel is the db structure for users
func FindOneUser ¶
FindOneUser will search for a user that matches the supplied condition. Will mask Record Not Found Errors.
func (*UserModel) SetPassword ¶
func (*UserModel) ValidatePassword ¶
Click to show internal directories.
Click to hide internal directories.