fixes on structuring

This commit is contained in:
Fran Jurmanović
2021-05-15 22:23:30 +02:00
parent e7a80796f7
commit cc98d0cf49
10 changed files with 125 additions and 60 deletions

View File

@@ -1,9 +1,20 @@
package models
import "time"
import (
"time"
"github.com/google/uuid"
)
type CommonModel struct {
Id string `json:"id" pg:"id"`
Id string `json:"id" pg:"id,pk"`
DateCreated time.Time `json:"dateCreated" pg:"datecreated"`
DateUpdated time.Time `json:"dateUpdated" pg:"dateupdated"`
}
func (cm *CommonModel) Init() {
date := time.Now()
cm.Id = uuid.NewString()
cm.DateCreated = date
cm.DateUpdated = date
}