Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Activity ¶
type Activity struct {
ID int `gorm:"primaryKey;not null" json:"-"`
// User 是觸發此事件之使用者的 UUID,若此事件無法對應到特定使用者,
// 則為空字串,此時將視為系統使用者所觸發。
User JsonNullString `gorm:"type:uuid" json:"user"`
// Server 是此事件所關聯之伺服器的 UUID。
Server string `gorm:"type:uuid;not null" json:"server"`
// Event 是描述發生了什麼事的字串,供 Panel 實例用來在活動記錄中
// 正確地對應此事件。
Event Event `gorm:"index;not null" json:"event"`
// Metadata 可以是空值、字串,或是提供額外事件特定中繼資料的 JSON 資料。
Metadata ActivityMeta `gorm:"serializer:json" json:"metadata"`
// IP 是觸發此事件的 IP 位址,若無法正確判斷則為空字串。此值應為
// 連線使用者的 IP 位址,而非內部系統的 IP。
IP string `gorm:"not null" json:"ip"`
Timestamp time.Time `gorm:"not null" json:"timestamp"`
}
Activity 定義使用者對某伺服器實體所執行的活動記錄事件。這用於追蹤 指令、電源操作與 SFTP 事件,以便進行整合並回傳給 Panel 實例顯示給使用者。
func (*Activity) BeforeCreate ¶
BeforeCreate 會在建立任何活動記錄之前執行,以確保 IP 位址 已去除多餘的資料,並將時間戳設定為目前的系統時間,再以 UTC 儲存。
type ActivityMeta ¶
type ActivityMeta map[string]interface{}
type JsonNullString ¶
type JsonNullString struct {
sql.NullString
}
func (JsonNullString) MarshalJSON ¶
func (v JsonNullString) MarshalJSON() ([]byte, error)
func (*JsonNullString) UnmarshalJSON ¶
func (v *JsonNullString) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.