model

package
v0.0.0-...-ec76f1a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        uint64         `json:"id,omitempty"        gorm:"primary_key;AUTO_INCREMENT;column:id"`
	CreatedAt time.Time      `json:"createdAt,omitempty" gorm:"column:created_at"`
	CreatedBy string         `json:"CreatedBy,omitempty" gorm:"column:created_by"`
	UpdatedAt time.Time      `json:"updatedAt,omitempty" gorm:"column:updated_at"`
	UpdatedBy string         `json:"UpdatedBy,omitempty" gorm:"column:updated_by"`
	DeletedAt gorm.DeletedAt `json:"deletedAt,omitempty" gorm:"column:deleted_at;index:idx_deleted_at"`
	DeletedBy gorm.DeletedAt `json:"deletedBy,omitempty" gorm:"column:deleted_by;index:idx_deleted_at"`
}

BaseModel is to replace `gorm.BaseModel`.

type JobInfo

type JobInfo struct {
	BaseModel
	JobId   uint64 `json:"job_id,omitempty" gorm:"column:job_id;not null"`
	JobDesc string `json:"job_desc" gorm:"column:job_desc;" binding:"required" validate:"min=1,max=256"`
}

func (*JobInfo) BeforeCreate

func (p *JobInfo) BeforeCreate(tx *gorm.DB) error

BeforeCreate run before create database record.

func (*JobInfo) TableName

func (p *JobInfo) TableName() string

TableName maps to mysql table name.

func (*JobInfo) Validate

func (p *JobInfo) Validate() error

Validate the fields.

type JobInfoList

type JobInfoList struct {
	meta.ListMeta `json:",inline"`

	Items []*JobInfo `json:"items"`
}

JobInfoList is the whole list of all posts which have been stored in stroage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL