db

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        int64     `json:"id" gorm:"primary_key"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type Notify

type Notify struct {
	gorm.Model
	NotifyID   string `gorm:"column:notify_id"`
	NotifyName string `gorm:"column:notify_name"`
	Target     string `gorm:"column:target"`
	Scope      string `gorm:"column:scope"`
	ScopeID    string `gorm:"column:scope_id"`
	Attributes string `json:"attributes"`
	Enable     bool   `gorm:"enable"`
}

func (*Notify) TableName

func (n *Notify) TableName() string

type NotifyConfig

type NotifyConfig struct {
	gorm.Model
	NotifyID  string `gorm:"column:notify_id"`
	Metadata  string `gorm:"column:metadata"`
	Behavior  string `gorm:"column:behavior"`
	Templates string `gorm:"column:templates"`
	Scope     string `gorm:"column:scope"`
	ScopeID   string `gorm:"column:scope_id"`
}

func (*NotifyConfig) TableName

func (c *NotifyConfig) TableName() string

type NotifyDB

type NotifyDB struct {
	DB *gorm.DB
}

func New

func New(db *gorm.DB) *NotifyDB

func (*NotifyDB) CheckNotifyNameExist

func (n *NotifyDB) CheckNotifyNameExist(scopeID, scopeName, notifyName string) (bool, error)

func (*NotifyDB) CheckNotifyTemplateExist

func (n *NotifyDB) CheckNotifyTemplateExist(scope, scopeID string) (*[]NotifyConfig, error)

func (*NotifyDB) CreateNotifyGroup

func (n *NotifyDB) CreateNotifyGroup(notifyGroup *NotifyGroup) (id int64, err error)

func (*NotifyDB) CreateNotifyRecord

func (n *NotifyDB) CreateNotifyRecord(record *Notify) error

func (*NotifyDB) CreateUserDefineNotifyTemplate

func (n *NotifyDB) CreateUserDefineNotifyTemplate(customize *NotifyConfig) error

func (*NotifyDB) DeleteNotifyRecord

func (n *NotifyDB) DeleteNotifyRecord(id int64) error

func (*NotifyDB) GetAllNotifyGroup

func (n *NotifyDB) GetAllNotifyGroup(scope, scopeId string, orgId int64) ([]model.GetAllGroupData, error)

func (*NotifyDB) GetAllUserDefineNotify

func (n *NotifyDB) GetAllUserDefineNotify(scope, scopeID string) (*[]NotifyConfig, error)

func (*NotifyDB) GetAllUserDefineTemplates

func (n *NotifyDB) GetAllUserDefineTemplates() (*[]NotifyConfig, error)

func (*NotifyDB) GetNotify

func (n *NotifyDB) GetNotify(id int64) (*Notify, error)

func (*NotifyDB) GetNotifyGroup

func (n *NotifyDB) GetNotifyGroup(id int64) (*NotifyGroup, error)

func (*NotifyDB) GetNotifyList

func (n *NotifyDB) GetNotifyList(notifyListReq *model.QueryNotifyListReq) ([]*Notify, error)

func (*NotifyDB) GetProjectByScopeID

func (n *NotifyDB) GetProjectByScopeID(scopeID string) (projectID string, err error)

func (*NotifyDB) GetUserDefine

func (n *NotifyDB) GetUserDefine(notifyId string) (*NotifyConfig, error)

func (*NotifyDB) UpdateEnable

func (n *NotifyDB) UpdateEnable(id int64) error

func (*NotifyDB) UpdateNotify

func (n *NotifyDB) UpdateNotify(updateNotify *Notify) error

type NotifyGroup

type NotifyGroup struct {
	BaseModel
	Name        string `gorm:"size:150"`
	ScopeType   string `gorm:"size:150;index:idx_scope_type"`
	ScopeID     string `gorm:"size:150;index:idx_scope_id"`
	OrgID       int64  `gorm:"index:idx_org_id"`
	TargetData  string `gorm:"type:text"`
	Label       string `gorm:"size:200"`
	ClusterName string
	AutoCreate  bool
	Creator     string `gorm:"size:150"`
}

func (NotifyGroup) TableName

func (NotifyGroup) TableName() string

func (*NotifyGroup) ToApiData

func (notifyGroup *NotifyGroup) ToApiData() *apistructs.NotifyGroup

type NotifyRecord

type NotifyRecord struct {
	NotifyId    string    `json:"notify_id" gorm:"column:notify_id"`
	NotifyName  string    `json:"notify_name" gorm:"column:notify_name"`
	ScopeType   string    `json:"scope_type" gorm:"column:scope_type"`
	ScopeId     int64     `json:"scope_id" gorm:"column:scope_id"`
	GroupId     string    `json:"group_id" gorm:"column:group_id"`
	NotifyGroup string    `json:"notify_group" gorm:"column:notify_group"`
	Title       string    `json:"title" gorm:"column:title"`
	NotifyTime  time.Time `json:"notify_time" gorm:"column:notify_time"`
	CreateTime  time.Time `json:"create_time" gorm:"column:create_time"`
	UpdateTime  time.Time `json:"update_time" gorm:"column:update_time"`
}

func (*NotifyRecord) TableName

func (n *NotifyRecord) TableName() string

Jump to

Keyboard shortcuts

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