package db import ( "golang.org/x/crypto/bcrypt" log "github.com/sirupsen/logrus" "reichard.io/imagini/internal/models" ) func (dbm *DBManager) CreateUser(user models.User) (models.User, error) { log.Info("[db] Creating user: ", user.Username) hashedPassword, err := bcrypt.GenerateFromPassword([]byte(user.Password), bcrypt.DefaultCost) if err != nil { log.Error(err) return user, err } user.Password = string(hashedPassword) err = dbm.db.Create(&user).Error return user, err } func (dbm *DBManager) User (user models.User) (models.User, error) { var foundUser models.User var count int64 err := dbm.db.Where(&user).First(&foundUser).Count(&count).Error return foundUser, err } func (dbm *DBManager) DeleteUser (user models.User) error { return nil } func (dbm *DBManager) UpdatePassword (user models.User, pw string) { }