go-common/app/admin/main/aegis/model/net/transition.go
2019-04-22 18:49:16 +08:00

49 lines
1.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package net
import (
"time"
)
//..
const (
TableTransition = "net_transition"
//TriggerManual 人工触发一旦enable执行由人审核提交
TriggerManual = int8(1)
//TriggerAuto 自动触发一旦enable就可执行
TriggerAuto = int8(2)
//TriggerMsg 消息触发一旦enable执行为接收到指定消息
TriggerMsg = int8(3)
)
//TriggerDesc 变迁触发类型描述
var TriggerDesc = map[int8]string{
TriggerAuto: "直序",
TriggerManual: "人工",
TriggerMsg: "消息",
}
//Transition 变迁
type Transition struct {
ID int64 `gorm:"primary_key" json:"id" form:"id" validate:"omitempty,gt=0"`
NetID int64 `gorm:"column:net_id" json:"net_id" form:"net_id" validate:"omitempty,gt=0"`
Trigger int8 `gorm:"column:trigger" json:"trigger" default:"1" form:"trigger"`
Limit int64 `gorm:"column:limit" json:"limit" form:"limit"`
Name string `gorm:"column:name" json:"name" form:"name" validate:"required,max=32"`
ChName string `gorm:"column:ch_name" json:"ch_name" form:"ch_name" validate:"required,max=16"`
Description string `gorm:"column:description" json:"description" form:"description" validate:"max=60"`
UID int64 `gorm:"column:uid" json:"uid"`
DisableTime time.Time `gorm:"column:disable_time" json:"disable_time"`
Ctime time.Time `gorm:"column:ctime" json:"ctime"`
Mtime time.Time `gorm:"column:mtime" json:"mtime"`
}
//TableName .
func (t *Transition) TableName() string {
return TableTransition
}
//IsAvailable .
func (t *Transition) IsAvailable() bool {
return t.DisableTime.IsZero()
}