Documentation ¶ Index ¶ func Init(database *gorm.DB) func Paginate(page int, pageSize int) func(db *gorm.DB) *gorm.DB type FormBase type ModelBase func (base *ModelBase) BeforeCreate(db *gorm.DB) error type Test func (model *Test) MapToForm() *TestForm type TestForm func (form *TestForm) MapToModel() *Test Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func Init ¶ func Init(database *gorm.DB) func Paginate ¶ func Paginate(page int, pageSize int) func(db *gorm.DB) *gorm.DB Types ¶ type FormBase ¶ type FormBase struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } type ModelBase ¶ type ModelBase struct { ID string `gorm:"type:char(36);primary_key;"` CreatedAt time.Time UpdatedAt time.Time } func (*ModelBase) BeforeCreate ¶ func (base *ModelBase) BeforeCreate(db *gorm.DB) error type Test ¶ type Test struct { ModelBase Name string `gorm:"size:255;not null"` // Test name } Satellite Model func (*Test) MapToForm ¶ func (model *Test) MapToForm() *TestForm MapToForm maps the Test model to a TestForm. type TestForm ¶ type TestForm struct { FormBase Name string `json:"name" validate:"required,min=2,max=255"` // Satellite name } func (*TestForm) MapToModel ¶ func (form *TestForm) MapToModel() *Test Source Files ¶ View all Source files forms.go models.go test.go Click to show internal directories. Click to hide internal directories.