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.

33 lines
692 B

package Database
import (
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
func CreatePostImage(postImageData *Models.PostImage) error {
return DB.Session(&gorm.Session{FullSaveAssociations: true}).
Create(postImageData).
Error
}
func GetPostImageById(id string) (Models.PostImage, error) {
var (
postImageData Models.PostImage
err error
)
err = DB.Preload(clause.Associations).
First(&postImageData, "id = ?", id).
Error
return postImageData, err
}
func DeletePostImage(postImageData *Models.PostImage) error {
return DB.Session(&gorm.Session{FullSaveAssociations: true}).
Delete(postImageData).
Error
}