21 lines
463 B
Go
21 lines
463 B
Go
package db
|
|
|
|
// new creates a new and empty attachment
|
|
func (attachment *Attachment) new() (*Attachment, error) {
|
|
attachment = &Attachment{}
|
|
if err := conn.Create(attachment).Error; err != nil {
|
|
return attachment, err
|
|
}
|
|
return attachment, nil
|
|
}
|
|
|
|
// save saves the (modified) Attachment
|
|
func (attachment *Attachment) save() error {
|
|
attachment = &Attachment{}
|
|
if err := conn.Create(attachment).Error; err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|