database

package
v0.0.0-...-6379f91 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

关闭数据库连接

func Init

func Init(dbPath string) error

初始化数据库,建立连接并创建表(如不存在)

func SaveECSRecords

func SaveECSRecords(records []ECSRecord) error

SaveECSRecords 将一组 ECS 实例记录保存到数据库

func SavePolarDBRecords

func SavePolarDBRecords(records []PolarDBRecord) error

func SaveRDSRecords

func SaveRDSRecords(records []RDSRecord) error

func SaveRedisRecords

func SaveRedisRecords(records []RedisRecord) error

func SaveSLBRecords

func SaveSLBRecords(records []SLBRecord) error

Types

type ECSRecord

type ECSRecord struct {
	InstanceID   string // 实例ID
	CloudName    string // 账户名称
	InstanceName string // 实例名称
	Status       string // 实例状态
	RegionID     string // 区域ID
	OSName       string // 操作系统名称
	InstanceType string // 实例规格
	CPU          int64  // CPU核数
	Memory       int64  // 内存大小
	PublicIP     string // 公网IP地址(逗号分隔)
	PrivateIP    string // 内网IP地址
}

ECSRecord 定义 ECS 记录的本地结构,用于数据库读写

func ListECSRecords

func ListECSRecords() ([]ECSRecord, error)

查询所有 ECS 记录(用于 API 层示例)

type PolarDBRecord

type PolarDBRecord struct {
	InstanceID       string
	CloudName        string
	Engine           string
	RegionID         string
	Status           string
	DBNodeCount      int64
	Description      string
	MemorySize       int64
	ConnectionString string
}

PolarDB 数据结构和保存

func ListPolarDBRecords

func ListPolarDBRecords() ([]PolarDBRecord, error)

查询所有 Polardb 记录(用于 API 层示例)

type RDSRecord

type RDSRecord struct {
	InstanceID       string
	CloudName        string
	Engine           string
	RegionID         string
	Status           string
	Memory           int64
	Description      string
	ConnectionString string
}

RDS 数据结构和保存

func ListRDSRecords

func ListRDSRecords() ([]RDSRecord, error)

查询所有 RDS 记录(用于 API 层示例)

type RedisRecord

type RedisRecord struct {
	InstanceID       string
	CloudName        string
	InstanceName     string
	Port             int64
	RegionId         string
	Capacity         int64
	InstanceClass    string
	QPS              int64
	Bandwidth        int64
	Connections      int64
	InstanceType     string
	ConnectionString string
	IPAddress        string
}

Tair 数据结构和保存

func ListRedisRecords

func ListRedisRecords() ([]RedisRecord, error)

查询所有 Tair Redis 记录(用于 API 层示例)

type SLBRecord

type SLBRecord struct {
	InstanceID       string
	CloudName        string
	LoadBalancerName string
	IPAddress        string
	Bandwidth        int64
	NetworkType      string
	RegionID         string
	Status           string
}

SLB 数据结构和保存

func ListSLBRecords

func ListSLBRecords() ([]SLBRecord, error)

查询所有 SLB 记录(用于 API 层示例)

Jump to

Keyboard shortcuts

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