db

package
v0.0.0-...-8d92f6c Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
)
View Source
var (
	InfluxClient *influxdb3.Client
)

Functions

func ConnectDB

func ConnectDB()

func ConnectInfluxDB

func ConnectInfluxDB()

func RunMigrations

func RunMigrations()

func WritePingResult

func WritePingResult(ip, node, status string, latency float64)

Types

type IP

type IP struct {
	ID            uuid.UUID  `gorm:"type:char(36);primary_key"`
	IPAddress     string     `gorm:"type:varchar(15);unique_index;not null"`
	Note          string     `gorm:"type:varchar(64);"`
	CreatedAt     time.Time  `gorm:"default:CURRENT_TIMESTAMP"`
	LastUpdatedAt *time.Time `gorm:"default:NULL"`
	Status        IPStatus   `gorm:"type:enum('active', 'blocked', 'suspended);not null"`
}

func (*IP) BeforeCreate

func (ip *IP) BeforeCreate(scope *gorm.Scope) error

type IPStatus

type IPStatus string
const (
	Active    IPStatus = "active"
	Blocked   IPStatus = "blocked"
	Suspended IPStatus = "suspended"
)

Jump to

Keyboard shortcuts

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