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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Database

func Database(connString string) error

func NewDBClient

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

Types

type AccessControl

type AccessControl struct {
	ID                int64  `json:"id" gorm:"primary_key"`
	ServiceID         int64  `json:"service_id" gorm:"column:service_id" description:"服务id"`
	OpenAuth          int    `json:"open_auth" gorm:"column:open_auth" description:"是否开启权限 1=开启"`
	BlackList         string `json:"black_list" gorm:"column:black_list" description:"黑名单ip"`
	WhiteList         string `json:"white_list" gorm:"column:white_list" description:"白名单ip"`
	ClientIPFlowLimit int    `json:"clientip_flow_limit" gorm:"column:clientip_flow_limit" description:"客户端ip限流"`
	ServiceFlowLimit  int    `json:"service_flow_limit" gorm:"column:service_flow_limit" description:"服务端限流"`
}

func (*AccessControl) TableName

func (t *AccessControl) TableName() string

type AccessControlDao

type AccessControlDao struct {
	*gorm.DB
}

func NewAccessControlDao

func NewAccessControlDao(ctx context.Context, db ...*gorm.DB) *AccessControlDao

func (*AccessControlDao) Delete

func (d *AccessControlDao) Delete(ID int64) error

func (*AccessControlDao) Find

func (d *AccessControlDao) Find(search *AccessControl) (*AccessControl, error)

func (*AccessControlDao) ListBYServiceID

func (d *AccessControlDao) ListBYServiceID(c *gin.Context, tx *gorm.DB, serviceID int64) ([]AccessControl, int64, error)

func (*AccessControlDao) Save

func (d *AccessControlDao) Save(accessControl *AccessControl) error

type Admin

type Admin struct {
	Id        int       `json:"id" gorm:"primary_key" description:"自增主键"`
	UserName  string    `json:"user_name" gorm:"column:user_name" description:"管理员用户名"`
	Password  string    `json:"password" gorm:"column:password" description:"密码"`
	UpdatedAt time.Time `json:"update_at" gorm:"column:update_at" description:"更新时间"`
	CreatedAt time.Time `json:"create_at" gorm:"column:create_at" description:"创建时间"`
	IsDelete  int       `json:"is_delete" gorm:"column:is_delete" description:"是否删除"`
}

func (*Admin) TableName

func (admin *Admin) TableName() string

type AdminDao

type AdminDao struct {
	*gorm.DB
}

func NewAdminDao

func NewAdminDao(ctx context.Context) *AdminDao

func (*AdminDao) Find

func (d *AdminDao) Find(admin *Admin) (ret *Admin, err error)

func (*AdminDao) Update

func (d *AdminDao) Update(admin *Admin) error

type App

type App struct {
	ID        int64     `json:"id" gorm:"primary_key"`
	AccessKey string    `json:"access_key" gorm:"column:access_key" description:"租户key	"`
	Name      string    `json:"name" gorm:"column:name" description:"租户名称"`
	SecretKey string    `json:"secret_key" gorm:"column:secret_key" description:"密钥"`
	Qpd       int64     `json:"qpd" gorm:"column:qpd" description:"日请求量限制"`
	Qps       int64     `json:"qps" gorm:"column:qps" description:"每秒请求量限制"`
	CreatedAt time.Time `json:"create_at" gorm:"column:create_at" description:"添加时间"`
	UpdatedAt time.Time `json:"update_at" gorm:"column:update_at" description:"更新时间"`
	IsDelete  int8      `json:"is_delete" gorm:"column:is_delete" description:"是否已删除;0:否;1:是"`
}

func (*App) TableName

func (t *App) TableName() string

type AppDao

type AppDao struct {
	*gorm.DB
}

func NewAppDao

func NewAppDao(ctx context.Context) *AppDao

func (*AppDao) APPList

func (d *AppDao) APPList(params *dto.APPListInput) ([]App, int64, error)

func (*AppDao) Create

func (d *AppDao) Create(app *App) error

func (*AppDao) Find

func (d *AppDao) Find(app *App) (*App, error)

func (*AppDao) Update

func (d *AppDao) Update(app *App) error

func (*AppDao) Updates

func (d *AppDao) Updates(app *App) error

type HttpRule

type HttpRule struct {
	ID             int64  `json:"id" gorm:"primary_key"`
	ServiceID      int64  `json:"service_id" gorm:"column:service_id" description:"服务id"`
	RuleType       int    `json:"rule_type" gorm:"column:rule_type" description:"匹配类型 domain=域名, url_prefix=url前缀"`
	Rule           string `json:"rule" gorm:"column:rule" description:"type=domain表示域名,type=url_prefix时表示url前缀"`
	NeedStripUri   int    `json:"need_strip_uri" gorm:"column:need_strip_uri" description:"启用strip_uri 1=启用"`
	UrlRewrite     string `json:"url_rewrite" gorm:"column:url_rewrite" description:"url重写功能,每行一个	"`
	HeaderTransfor string `` /* 157-byte string literal not displayed */
}

func (*HttpRule) TableName

func (t *HttpRule) TableName() string

type HttpRuleDao

type HttpRuleDao struct {
	*gorm.DB
}

func NewHttpRuleDao

func NewHttpRuleDao(ctx context.Context, db ...*gorm.DB) *HttpRuleDao

func (*HttpRuleDao) Delete

func (d *HttpRuleDao) Delete(ID int64) error

func (*HttpRuleDao) Find

func (d *HttpRuleDao) Find(search *HttpRule) (*HttpRule, error)

func (*HttpRuleDao) ListByServiceID

func (d *HttpRuleDao) ListByServiceID(serviceID int64) ([]HttpRule, int64, error)

func (*HttpRuleDao) Save

func (d *HttpRuleDao) Save(httpRule *HttpRule) error

type LoadBalance

type LoadBalance struct {
	ID                     int64  `json:"id" gorm:"primary_key"`
	ServiceID              int64  `json:"service_id" gorm:"column:service_id" description:"服务id	"`
	RoundType              int    `json:"round_type" gorm:"column:round_type" description:"轮询方式 round/weight_round/random/ip_hash"`
	ProxyName              string `json:"proxy_name" gorm:"column:proxy_name" description:"被代理服务名"`
	UpstreamConnectTimeout int    `json:"upstream_connect_timeout" gorm:"column:upstream_connect_timeout" description:"下游建立连接超时, 单位s"`
	UpstreamHeaderTimeout  int    `json:"upstream_header_timeout" gorm:"column:upstream_header_timeout" description:"下游获取header超时, 单位s	"`
	UpstreamIdleTimeout    int    `json:"upstream_idle_timeout" gorm:"column:upstream_idle_timeout" description:"下游链接最大空闲时间, 单位s	"`
	UpstreamMaxIdle        int    `json:"upstream_max_idle" gorm:"column:upstream_max_idle" description:"下游最大空闲链接数"`
}

func (*LoadBalance) TableName

func (t *LoadBalance) TableName() string

type LoadBalanceDao

type LoadBalanceDao struct {
	*gorm.DB
}

func NewLoadBalanceDao

func NewLoadBalanceDao(ctx context.Context, db ...*gorm.DB) *LoadBalanceDao

func (*LoadBalanceDao) Delete

func (d *LoadBalanceDao) Delete(ID int64) error

func (*LoadBalanceDao) Find

func (d *LoadBalanceDao) Find(search *LoadBalance) (*LoadBalance, error)

func (*LoadBalanceDao) Save

func (d *LoadBalanceDao) Save(loadBalance *LoadBalance) error

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) Delete

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

func (*NodeDao) Find

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

func (*NodeDao) NodeList

func (d *NodeDao) NodeList(params *dto.NodeListInput) ([]Node, int64, error)

func (*NodeDao) Updates

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

type ServiceDetail

type ServiceDetail struct {
	Info          *ServiceInfo   `json:"info" description:"基本信息"`
	HTTPRule      *HttpRule      `json:"http_rule" description:"http_rule"`
	LoadBalance   *LoadBalance   `json:"load_balance" description:"load_balance"`
	AccessControl *AccessControl `json:"access_control" description:"access_control"`
}

type ServiceInfo

type ServiceInfo struct {
	ID           int64     `json:"id" gorm:"primary_key"`
	ProtocolType int       `json:"protocol_type" gorm:"column:protocol_type" description:"协议类型 0=http 1=https 2=websocket 3=tcp 4=grpc"`
	ServiceName  string    `json:"service_name" gorm:"column:service_name" description:"服务名称"`
	ServiceDesc  string    `json:"service_desc" gorm:"column:service_desc" description:"服务描述"`
	UpdatedAt    time.Time `json:"create_at" gorm:"column:create_at" description:"更新时间"`
	CreatedAt    time.Time `json:"update_at" gorm:"column:update_at" description:"添加时间"`
}

func (*ServiceInfo) TableName

func (t *ServiceInfo) TableName() string

type ServiceInfoDao

type ServiceInfoDao struct {
	*gorm.DB
}

func NewServiceInfoDao

func NewServiceInfoDao(ctx context.Context, db ...*gorm.DB) *ServiceInfoDao

func (*ServiceInfoDao) Delete

func (d *ServiceInfoDao) Delete(ID int64) error

func (*ServiceInfoDao) Find

func (d *ServiceInfoDao) Find(search *ServiceInfo) (*ServiceInfo, error)

func (*ServiceInfoDao) GroupByProtocolType

func (d *ServiceInfoDao) GroupByProtocolType() ([]dto.DashServiceStatItemOutput, error)

func (*ServiceInfoDao) PageList

func (d *ServiceInfoDao) PageList(param *dto.ServiceListInput) ([]ServiceInfo, int64, error)

func (*ServiceInfoDao) Save

func (d *ServiceInfoDao) Save(serviceInfo *ServiceInfo) error

func (*ServiceInfoDao) ServiceDetail

func (d *ServiceInfoDao) ServiceDetail(c *gin.Context, search *ServiceInfo) (*ServiceDetail, error)

Jump to

Keyboard shortcuts

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