1234567891011121314151617181920212223242526272829303132 |
- package sandbox
- import (
- "eta_gn/eta_api/global"
- "time"
- )
- type SandboxDraft struct {
- SandboxDraftId int `gorm:"primaryKey;column:sandbox_draft_id;type:int(9) unsigned;not null"`
- SandboxId int `gorm:"index:idx_sandbox_user_id;column:sandbox_id;type:int(9) unsigned;not null;default:0"`
- Name string `gorm:"column:name;type:varchar(64);not null;default:''"`
- ChartPermissionId int `gorm:"column:chart_permission_id;type:int(9) unsigned;not null;default:0"`
- ChartPermissionName string `gorm:"column:chart_permission_name;type:varchar(32);not null;default:''"`
- CurrVersion int `gorm:"column:curr_version;type:int(9) unsigned;not null;default:0"`
- Content string `gorm:"column:content;type:text;not null"`
- OpUserId int `gorm:"index:idx_sandbox_user_id;column:op_user_id;type:int(10) unsigned;not null;default:0"`
- OpUserName string `gorm:"column:op_user_name;type:varchar(32);not null;default:''"`
- CreateTime time.Time `gorm:"column:create_time;type:timestamp;default:CURRENT_TIMESTAMP"`
- }
- func AddSandboxDraft(sandboxDraft *SandboxDraft) (err error) {
- err = global.DmSQL["data"].Create(sandboxDraft).Error
- return
- }
- func GetLastSandboxDraftById(sandboxId int) (sandboxDraft *SandboxDraft, err error) {
- sql := `select * from sandbox_draft where sandbox_id = ? order by sandbox_draft_id desc `
- err = global.DmSQL["data"].Raw(sql, sandboxId).First(&sandboxDraft).Error
- return
- }
|