Files
wallet-go-api/pkg/models/db.go
Fran Jurmanović 81e55896b1 fixed pg types
2021-06-29 21:36:24 +02:00

21 lines
392 B
Go

package models
import (
"time"
"github.com/google/uuid"
)
type BaseModel struct {
Id string `json:"id" pg:"id,pk,notnull"`
DateCreated time.Time `json:"dateCreated" pg:"date_created"`
DateUpdated time.Time `json:"dateUpdated" pg:"date_updated"`
}
func (cm *BaseModel) Init() {
date := time.Now()
cm.Id = uuid.NewString()
cm.DateCreated = date
cm.DateUpdated = date
}