Files
lti-api/tools/templates/entity.tmpl

20 lines
510 B
Cheetah

{{define "entity"}}package entities
import (
"time"
"gorm.io/gorm"
)
type {{Pascal .Entity}} struct {
Id uint `gorm:"primaryKey"`
Name string `gorm:"not null;uniqueIndex:idx_name,where:deleted_at IS NULL"`
CreatedBy uint `gorm:"not null"`
CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
CreatedUser User `gorm:"foreignKey:CreatedBy;references:Id"`
}
{{end}}