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.

46 lines
777 B

package Database
import (
"git.tovijaeschke.xyz/tovi/Capsule/Backend/Models"
"gorm.io/gorm/clause"
)
// GetSessionByID Gets session
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
}
// CreateSession creates session
func CreateSession(session *Models.Session) error {
var (
err error
)
err = DB.Create(session).Error
return err
}
// DeleteSession deletes session
func DeleteSession(session *Models.Session) error {
return DB.Delete(session).Error
}
// DeleteSessionByID deletes session
func DeleteSessionByID(id string) error {
return DB.Delete(
&Models.Session{},
"id = ?",
id,
).Error
}