package Database import ( "git.tovijaeschke.xyz/tovi/Envelope/Backend/Models" "gorm.io/gorm" "gorm.io/gorm/clause" ) func GetMessageDataById(id string) (Models.MessageData, error) { var ( messageData Models.MessageData err error ) err = DB.Preload(clause.Associations). First(&messageData, "id = ?", id). Error return messageData, err } func CreateMessageData(messageData *Models.MessageData) error { var ( err error ) err = DB.Session(&gorm.Session{FullSaveAssociations: true}). Create(messageData). Error return err } func DeleteMessageData(messageData *Models.MessageData) error { return DB.Session(&gorm.Session{FullSaveAssociations: true}). Delete(messageData). Error }