mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
21 lines
384 B
Go
21 lines
384 B
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type BaseModel struct {
|
|
Id string `json:"id" pg:"id,pk"`
|
|
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
|
|
}
|