db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func GetPGDB

func GetPGDB() (*gorm.DB, error)

func GetSqliteDB

func GetSqliteDB() (*gorm.DB, error)

func InitDB

func InitDB()

Types

type Models

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

func (*Models) Add

func (ms *Models) Add(m ...interface{})

type NeedNode

type NeedNode struct {
	gorm.Model
	NodeName     string `json:"node_name" gorm:"not null;index;comment:需要订阅的节点名称"`
	WebHookRefer *uint  `json:"web_hook_refer" gorm:"comment:WebHook foreign key"` // 外键,在数据库中最好不要not null,在逻辑上去判空
}

type WebHookConditions

type WebHookConditions struct {
	gorm.Model
	Condition string     `json:"condition" gorm:"not null;comment:条件表达式"`
	WebHooks  []WebHooks `gorm:"foreignKey:WebHookConditionRefer"`
}

type WebHooks

type WebHooks struct {
	gorm.Model
	Name                  string     `json:"name" gorm:"unique;not null;index;comment:webhook名称"` // not null in db
	Url                   string     `json:"url" gorm:"unique;not null;index;comment:url地址"`
	Active                bool       `json:"active" gorm:"default:true;comment:是否激活"`
	WebHookConditionRefer *uint      `json:"web_hook_condition_refer" gorm:"comment:WebHookCondition foreign key"` // 外键,在数据库中最好不要not null,在逻辑上去判空
	NeedNodes             []NeedNode `gorm:"foreignKey:WebHookRefer"`
}

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

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