package Database import ( "git.tovijaeschke.xyz/tovi/Envelope/Backend/Models" "gorm.io/gorm" "gorm.io/gorm/clause" ) func GetMessageThreadUserById(id string) (Models.MessageThreadUser, error) { var ( message Models.MessageThreadUser err error ) err = DB.Preload(clause.Associations). First(&message, "id = ?", id). Error return message, err } func CreateMessageThreadUser(messageThreadUser *Models.MessageThreadUser) error { var ( err error ) err = DB.Session(&gorm.Session{FullSaveAssociations: true}). Create(messageThreadUser). Error return err } func DeleteMessageThreadUser(messageThreadUser *Models.MessageThreadUser) error { return DB.Session(&gorm.Session{FullSaveAssociations: true}). Delete(messageThreadUser). Error }