codegen: implement auto-timestamps for created_at and updated_at
This commit is contained in:
@@ -46,6 +46,18 @@ type Table struct {
|
||||
GoTypeName string
|
||||
}
|
||||
|
||||
func (t Table) HasAutoTimestamps() (hasCreatedAt bool, hasUpdatedAt bool) {
|
||||
for _, c := range t.Columns {
|
||||
if c.Name == "created_at" && c.Type == "integer" {
|
||||
hasCreatedAt = true
|
||||
}
|
||||
if c.Name == "updated_at" && c.Type == "integer" {
|
||||
hasUpdatedAt = true
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type Index struct {
|
||||
Name string `db:"index_name"`
|
||||
TableName string `db:"table_name"`
|
||||
|
||||
Reference in New Issue
Block a user