Documentation
¶
Index ¶
- Variables
- func Create(config *TaskConfig) error
- func Delete(id uint64) error
- func DeleteAt(id uint64) error
- func PaginateQuery(p *models.Pagination) (models.Response, error)
- func Save(config *TaskConfig) error
- func Updates(config *TaskConfig) error
- func UpdatesFromMap(id uint64, values map[string]interface{}) error
- type Tabler
- type TaskConfig
Constants ¶
This section is empty.
Variables ¶
var TaskConfigColumns = struct { ID string Headers string Content string DeletedAt string CreatedAt string CreatedBy string UpdatedAt string UpdatedBy string }{ ID: "id", Headers: "headers", Content: "content", DeletedAt: "deleted_at", CreatedAt: "created_at", CreatedBy: "created_by", UpdatedAt: "updated_at", UpdatedBy: "updated_by", }
TaskConfigColumns table field name.
Functions ¶
func PaginateQuery ¶
func PaginateQuery(p *models.Pagination) (models.Response, error)
PaginateQuery todo
func Save ¶
func Save(config *TaskConfig) error
Save a single task will be stored to db Note: all the fields will be updated to db, includes default value.
func Updates ¶
func Updates(config *TaskConfig) error
Updates updates from specific task that will not updating the zero value fields to db. 只能保存非零字段
func UpdatesFromMap ¶
UpdatesFromMap updates from specific task that will not updating the zero value fields to db. 只能保存map包含字段
Types ¶
type TaskConfig ¶
type TaskConfig struct { ID uint64 `gorm:"primaryKey,autoIncrement" json:"id" toml:"id" yaml:"id"` Headers datatypes.JSON `gorm:"type:json,column:headers" json:"headers" toml:"headers" yaml:"headers"` Content datatypes.JSON `gorm:"type:json,column:content" json:"content" toml:"content" yaml:"content"` DeletedAt uint64 `gorm:"column:deleted_at" json:"deleted_at" toml:"deleted_at" yaml:"deleted_at"` CreatedAt uint64 `gorm:"autoCreateTime:nano" json:"created_at" toml:"created_at" yaml:"created_at"` CreatedBy string `gorm:"column:created_by" json:"created_by,omitempty" toml:"created_by" yaml:"created_by,omitempty"` UpdatedAt uint64 `gorm:"autoUpdateTime:nano" json:"updated_at" toml:"updated_at" yaml:"updated_at"` UpdatedBy string `gorm:"column:updated_by" json:"updated_by,omitempty" toml:"updated_by" yaml:"updated_by,omitempty"` }
TaskConfig is an object representing the database table.
func GetExcludeDeleted ¶
func GetExcludeDeleted(id uint64) (*TaskConfig, error)
GetExcludeDeleted returns the task that excludes inactived by specific id.
func JSONQuery ¶
func JSONQuery(d models.InnerDetector) ([]TaskConfig, error)
JSONQuery returns TaskConfig array.
func (*TaskConfig) AfterCreate ¶
func (t *TaskConfig) AfterCreate(tx *gorm.DB) (err error)
AfterCreate do somethings, e.g. debug log.
func (*TaskConfig) AfterUpdate ¶
func (t *TaskConfig) AfterUpdate(tx *gorm.DB) (err error)
AfterUpdate do somethings, e.g. update other database in the same transcation. 在同一个事务中更新数据
func (*TaskConfig) BeforeUpdate ¶
func (t *TaskConfig) BeforeUpdate(tx *gorm.DB) (err error)
BeforeUpdate do somethings, e.g. updating the updated_at value.
func (TaskConfig) TableName ¶
func (TaskConfig) TableName() string
TableName 会将 User 的表名重写为 `profiles`