dao

package
v0.0.0-...-6cf1638 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MulanPSL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Database

func Database(connString string) error

func Init

func Init()

func NewDBClient

func NewDBClient(ctx context.Context) *gorm.DB

Types

type Node

type Node struct {
	ID         int64     `json:"id" gorm:"primary_key"`
	Name       string    `json:"name" gorm:"column:name" description:"节点名称"`
	Status     string    `json:"status" gorm:"column:status" description:"节点状态"`
	CreatedAt  time.Time `json:"create_at" gorm:"column:create_at" description:"添加时间"`
	UpdateAt   time.Time `json:"update_at" gorm:"column:update_at" description:"修改时间"`
	InternalIP string    `json:"internal_ip" gorm:"column:internal_ip" description:"内网IP"`
	ExternalIP string    `json:"external_ip" gorm:"column:external_ip" description:"外网IP"`
	Info       string    `json:"info" gorm:"column:info" description:"节点信息,json格式"`
	Containers string    `json:"containers" gorm:"column:containers" description:"容器信息,json格式"`
}

Node 结构体用于表示 node 表的行数据

func (*Node) TableName

func (t *Node) TableName() string

type NodeDao

type NodeDao struct {
	*gorm.DB
}

func NewNodeDao

func NewNodeDao(ctx context.Context) *NodeDao

func (*NodeDao) Create

func (d *NodeDao) Create(node *Node) error

func (*NodeDao) Find

func (d *NodeDao) Find(node *Node) (*Node, error)

func (*NodeDao) Updates

func (d *NodeDao) Updates(node *Node) error

Jump to

Keyboard shortcuts

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