Encrypted messaging app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
624 B

package Database
import (
"git.tovijaeschke.xyz/tovi/Envelope/Backend/Models"
"gorm.io/gorm/clause"
)
func GetSessionById(id string) (Models.Session, error) {
var (
session Models.Session
err error
)
err = DB.Preload(clause.Associations).
First(&session, "id = ?", id).
Error
return session, err
}
func CreateSession(session *Models.Session) error {
var (
err error
)
err = DB.Create(session).Error
return err
}
func DeleteSession(session *Models.Session) error {
return DB.Delete(session).Error
}
func DeleteSessionById(id string) error {
return DB.Delete(&Models.Session{}, id).Error
}