finish setup insert method, refactor sql migration file
This commit is contained in:
@@ -8,14 +8,18 @@ type Media struct {
|
||||
Caption string `json:"caption"`
|
||||
}
|
||||
|
||||
func (m *Media) ToDB(dest *db.Media) bool {
|
||||
func (m *Media) ToDB(dest **db.Media) bool {
|
||||
if dest == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
dest.Type = m.Type
|
||||
dest.URL = m.URL
|
||||
dest.Caption = m.Caption
|
||||
media := &db.Media{
|
||||
Type: m.Type,
|
||||
URL: m.URL,
|
||||
Caption: m.Caption,
|
||||
}
|
||||
|
||||
*dest = media
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user