package main
import (
"encoding/json"
"time"
"fmt"
)
type JSON json.RawMessage
type NullTime struct {
Time time.Time
Valid bool
}
type Model struct {
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt NullTime `gorm:"index:delete_at"`
}
type Model1 struct {
ID uint `gorm:"primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt NullTime `gorm:"index"`
}
type V3HistoryUser struct {
Applicant string `json:"applicant"`
Operator string `json:"operator"`
ItsmOrderId string `json:"itsm_order_id"`
}
type Test struct {
Model1
V3HistoryUser
InstanceId string `gorm:"column:instance_id;type:varchar(128);default:''" json:"instance_id"`
Ip string `gorm:"column:ip;type:varchar(64);default:''" json:"ip"`
CloudTypeId int `gorm:"column:cloud_type_id;type:int(11);default:0;comment:所属云" json:"cloud_type_id"`
EnvId int `gorm:"column:env_id;type:int(4);not null;default:0;comment:环境" json:"env_id"`
IsPublic int `gorm:"is_public;type:int(1);not null;default:0;comment:是否公用" json:"is_public"`
Port string `gorm:"column:port;type:varchar(256);not null;default:'';comment:开放端口" json:"port"`
NetworkPermissions string `gorm:"column:network_permissions;type:varchar(512);not null;default:'';comment:网络权限" json:"network_permissions"`
DomainNameId int `gorm:"domain_name_id:name;type:int(11);not null;default:0;comment:域名id" json:"domain_name_id"`
BusinessSystemId int `gorm:"column:business_system_id;type:int(11);not null;default:0;comment:业务线id" json:"business_system_id"`
ServiceType string `gorm:"service_type;type:varchar(128);not null;default:'';comment:服务类型(应用、数据库、中间件)" json:"service_type"`
ServiceName string `gorm:"service_name;type:varchar(256);not null;default:'';comment:服务名" json:"service_name"`
User string `gorm:"user;type:varchar(128);not null;default:'';comment:最后操作人" json:"user"`
RegionTypeId int `gorm:"column:region_type_id;type:int(11);default:0" json:"region_type_id"`
HostName string `gorm:"column:host_name;type:varchar(128);default:''" json:"host_name"`
HostType string `gorm:"column:host_type;type:varchar(128);default:'';comment:主机类型,ecs,物理机,虚拟机" json:"host_type"`
HostStatus string `gorm:"column:host_status;type:varchar(20);default:'online';comment:主机状态,上线、下线" json:"host_status"`
Cpu int32 `gorm:"column:cpu;type:int(11);not null;default:0;comment:cpu 核" json:"cpu"`
Memory int32 `gorm:"column:memory;type:int(11);not null;default:0;comment:内存 mb" json:"memory"`
Disk int64 `gorm:"column:disk;type:int(11);not null;default:0;comment:磁盘 gb" json:"disk"`
OsName string `gorm:"column:os_name;type:varchar(64);default:''" json:"os_name"`
MonitorStatus string `gorm:"column:monitor_status;type:varchar(64);default:'';监控状态,上线、下线" json:"monitor_status"`
}
func main() {
v1 := Test{}
j, _ := json.Marshal(v1)
fmt.Println(string(j))
}