model

package
v0.0.0-...-b9deefd Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NilObjectID = primitive.NilObjectID

Functions

This section is empty.

Types

type Bookmark

type Bookmark struct {
	ID       ObjectID `json:"id"                 bson:"_id,omitempty"`
	Name     string   `json:"name"               bson:"name"`
	Link     string   `json:"link"               bson:"link"`
	Category string   `json:"category"           bson:"category"`
	IconLink string   `json:"iconLink,omitempty" bson:"iconLink,omitempty"`
}

type BookmarkAddRequest

type BookmarkAddRequest struct {
	Name     string `json:"name"`
	Link     string `json:"link"`
	Category string `json:"category"`
}

type Bookmarks

type Bookmarks interface {
	Bookmarks() ([]Bookmark, error)
	Add(request BookmarkAddRequest) (*Bookmark, error)
	Update(bookmark Bookmark) error
	Delete(id ObjectID) error
}

type BookmarksImpl

type BookmarksImpl struct {
	// contains filtered or unexported fields
}

func NewBookmarks

func NewBookmarks(log logger.Logger, client *mongo.Client) *BookmarksImpl

func (*BookmarksImpl) Add

func (b *BookmarksImpl) Add(request BookmarkAddRequest) (*Bookmark, error)

func (*BookmarksImpl) Bookmarks

func (b *BookmarksImpl) Bookmarks() ([]Bookmark, error)

func (*BookmarksImpl) Delete

func (b *BookmarksImpl) Delete(id ObjectID) error

func (*BookmarksImpl) Update

func (b *BookmarksImpl) Update(bookmark Bookmark) error

type BuildInfo

type BuildInfo struct {
	Module       string            `json:"module"`
	Version      string            `json:"version"`
	Dependencies int               `json:"dependencies"`
	Settings     map[string]string `json:"settings"`
}

type CPUStats

type CPUStats struct {
	Cores []float64 `json:"cores"`
}

type DiskStats

type DiskStats struct {
	Path        string  `json:"path"`
	FSType      string  `json:"fsType"`
	Total       uint64  `json:"total"`
	Free        uint64  `json:"free"`
	Used        uint64  `json:"used"`
	UsedPercent float64 `json:"usedPercent"`
}

type Health

type Health interface {
	Health() (*HealthStats, error)
}

type HealthImpl

type HealthImpl struct {
	// contains filtered or unexported fields
}

func NewHealth

func NewHealth() (*HealthImpl, error)

func (*HealthImpl) Health

func (h *HealthImpl) Health() (*HealthStats, error)

type HealthStats

type HealthStats struct {
	Running   bool      `json:"running"`
	Random    int       `json:"random"`
	Time      string    `json:"time"`
	BuildInfo BuildInfo `json:"buildInfo"`
}

type LoadStats

type LoadStats struct {
	Load1  float64 `json:"load1"`
	Load5  float64 `json:"load5"`
	Load15 float64 `json:"load15"`
}

type ObjectID

type ObjectID = primitive.ObjectID

type RAMStats

type RAMStats struct {
	Total       uint64  `json:"total"`
	Free        uint64  `json:"free"`
	Used        uint64  `json:"used"`
	UsedPercent float64 `json:"usedPercent"`
}

type SwapStats

type SwapStats struct {
	Total       uint64  `json:"total"`
	Free        uint64  `json:"free"`
	Used        uint64  `json:"used"`
	UsedPercent float64 `json:"usedPercent"`
}

type System

type System interface {
	All() (*SystemStats, error)

	CPU() (*CPUStats, error)
	Load() (*LoadStats, error)
	RAM() (*RAMStats, error)
	Swap() (*SwapStats, error)
	Uptime() (*UptimeStats, error)
	Disk() (*DiskStats, error)
}

type SystemImpl

type SystemImpl struct {
	// contains filtered or unexported fields
}

func NewSystem

func NewSystem(cfg config.Config) *SystemImpl

func (*SystemImpl) All

func (s *SystemImpl) All() (*SystemStats, error)

func (*SystemImpl) CPU

func (s *SystemImpl) CPU() (*CPUStats, error)

func (*SystemImpl) Disk

func (s *SystemImpl) Disk() (*DiskStats, error)

func (*SystemImpl) Load

func (s *SystemImpl) Load() (*LoadStats, error)

func (*SystemImpl) RAM

func (s *SystemImpl) RAM() (*RAMStats, error)

func (*SystemImpl) Swap

func (s *SystemImpl) Swap() (*SwapStats, error)

func (*SystemImpl) Uptime

func (s *SystemImpl) Uptime() (*UptimeStats, error)

type SystemStats

type SystemStats struct {
	CPU    *CPUStats    `json:"cpu"`
	Load   *LoadStats   `json:"load"`
	RAM    *RAMStats    `json:"ram"`
	Swap   *SwapStats   `json:"swap"`
	Uptime *UptimeStats `json:"uptime"`
	Disk   *DiskStats   `json:"disk"`
}

type UptimeStats

type UptimeStats struct {
	BootTime uint64 `json:"bootTime"`
	Uptime   uint64 `json:"uptime"`
}

Jump to

Keyboard shortcuts

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