38 lines
689 B
Go
38 lines
689 B
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Meta struct {
|
|
ID string `json:"id" yaml:"id" gorm:"primaryKey"`
|
|
CreatedAt time.Time `json:"created_at" yaml:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at" yaml:"updated_at"`
|
|
|
|
UniqueIDFunc func() string `json:"-" yaml:"-"`
|
|
}
|
|
|
|
func (m *Meta) GetID() string {
|
|
if m.UniqueIDFunc != nil {
|
|
return m.UniqueIDFunc()
|
|
}
|
|
return m.ID
|
|
}
|
|
|
|
func (m *Meta) SetID(id string) {
|
|
m.ID = id
|
|
}
|
|
|
|
func (m *Meta) SetCreatedAt(t time.Time) {
|
|
m.CreatedAt = t
|
|
}
|
|
|
|
func (m *Meta) SetUpdatedAt(t time.Time) {
|
|
m.UpdatedAt = t
|
|
}
|
|
|
|
func (m *Meta) GetCreatedAt() time.Time {
|
|
return m.CreatedAt
|
|
}
|
|
|
|
func (m *Meta) GetUpdatedAt() time.Time {
|
|
return m.UpdatedAt
|
|
}
|