partial repository layer added

This commit is contained in:
Fran Jurmanović
2022-09-27 00:33:44 +02:00
parent 13ce0735d0
commit 82e97fc97f
73 changed files with 2686 additions and 1216 deletions

25
pkg/model/db.go Normal file
View File

@@ -0,0 +1,25 @@
package model
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"`
}
/*
Init
Initializes base model with DateCreated, DateUpdated, and Id values.
*/
func (cm *BaseModel) Init() {
date := time.Now()
cm.Id = uuid.NewString()
cm.DateCreated = date
cm.DateUpdated = date
}