model

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func DeleteAllStatusByUserID

func DeleteAllStatusByUserID(userID int64) error

func DeleteRankByUserID added in v0.0.3

func DeleteRankByUserID(userID int64) error

func GetURLByID

func GetURLByID(id int64) (string, error)

func Init

func Init()

Types

type Message

type Message struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	tele.StoredMessage
}

func GetAllMessage

func GetAllMessage() []Message

func GetAllMessageBefore

func GetAllMessageBefore(t time.Time) []Message

func (*Message) Delete

func (m *Message) Delete()

func (*Message) Save

func (m *Message) Save()

type RankList

type RankList struct {
	UserID        int64 `gorm:"primary_key"`
	ServerCount   int
	OnlineCount   int
	MemTotal      int64
	MemUsedTotal  int64
	DiskTotal     int64
	DiskUsedTotal int64
	Load15Total   float64
}

func GetDiskTotalTop

func GetDiskTotalTop(limit int) []*RankList

func GetDiskUsedTop

func GetDiskUsedTop(limit int) []*RankList

func GetLoad15Top

func GetLoad15Top(limit int) []*RankList

func GetMemTotalTop

func GetMemTotalTop(limit int) []*RankList

func GetMemUsedTop

func GetMemUsedTop(limit int) []*RankList

func GetOnlineCountTop

func GetOnlineCountTop(limit int) []*RankList

func GetServerCountTop

func GetServerCountTop(limit int) []*RankList

func (*RankList) Delete

func (rl *RankList) Delete()

func (*RankList) Save

func (rl *RankList) Save()

type Status

type Status struct {
	ID             int64 `gorm:"primary_key,unique_index,auto_increment"`
	UserID         int64
	ServerID       int
	RecordTime     time.Time
	RecordType     int // 0-Raw, 1-Avg5min, 2-Avg15min, 3-Avg60Min 4-Avg24Hour
	IsOnline       bool
	MemTotal       int64
	SwapTotal      int
	DiskTotal      int64
	CPUUsed        float64
	MemUsed        int64
	SwapUsed       int
	DiskUsed       int64
	NetInTransfer  int64
	NetOutTransfer int64
	NetInSpeed     int
	NetOutSpeed    int
	Load1          float64
	Load5          float64
	Load15         float64
	TCPConnCount   int
	UDPConnCount   int
	ProcessCount   int
}

func (*Status) Save

func (s *Status) Save() error

type User

type User struct {
	ID          int64 `gorm:"primary_key"`
	UserID      int64 `gorm:"unique_index"` //Telegram ID
	UserName    string
	FirstName   string
	LastName    string
	Valid       bool
	ConnectType int // 0: websocket, 1: API
	URL         string
	Token       string
}

func GetAllInvalidUser added in v0.0.3

func GetAllInvalidUser() ([]*User, error)

func GetAllValidUser

func GetAllValidUser() ([]*User, error)

func GetUserByID

func GetUserByID(id int64) (*User, error)

func GetUserWithMissInfo added in v0.0.3

func GetUserWithMissInfo() ([]*User, error)

func (*User) Save added in v0.0.3

func (u *User) Save() error

func (*User) Suspend added in v0.0.3

func (u *User) Suspend()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL