Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MaxIdleConn is set the maximum number of connections in the idle connection pool MaxIdleConn = 10 // MaxOpenConn is set the maximum number of open connections to the database MaxOpenConn = 100 // ConnMaxLifetime is set the maximum amount of time a connection maybe reused ConnMaxLifetime = time.Hour )
View Source
var (
DB *gorm.DB
)
View Source
var (
DefaultLimit = 50
)
Functions ¶
func DeleteAllClientInfo ¶
func DeleteAllClientInfo() error
func DeleteClientInfo ¶
func DeleteSendMsgInfo ¶
Types ¶
type ClientInfo ¶
type ClientInfo struct { ID string `json:"id" gorm:"primaryKey"` IP string `json:"ip" gorm:"not null"` Port int `json:"port" gorm:"not null"` Online bool `json:"online" gorm:"default:false"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func GetAllClientInfo ¶
func GetAllClientInfo() ([]*ClientInfo, error)
func GetClientInfo ¶
func GetClientInfo(id string) (*ClientInfo, error)
func (*ClientInfo) Create ¶
func (c *ClientInfo) Create() error
func (*ClientInfo) LoadUnConsumeSendMsgInfo ¶
func (c *ClientInfo) LoadUnConsumeSendMsgInfo(limit int) ([]*SendMsgInfo, error)
func (*ClientInfo) TableName ¶
func (c *ClientInfo) TableName() string
func (*ClientInfo) Update ¶
func (c *ClientInfo) Update() error
func (*ClientInfo) UpdateOrCreate ¶
func (c *ClientInfo) UpdateOrCreate() error
type ReceiveMsgInfo ¶
type ReceiveMsgInfo struct { ID string `json:"id" gorm:"primaryKey"` Data string `json:"data" gorm:"-"` CommitStatus int `json:"commit_status" gorm:"column:commit_status;default:0"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` }
func (*ReceiveMsgInfo) Create ¶
func (r *ReceiveMsgInfo) Create() error
func (*ReceiveMsgInfo) IsConsume ¶
func (r *ReceiveMsgInfo) IsConsume() (bool, error)
func (*ReceiveMsgInfo) TableName ¶
func (r *ReceiveMsgInfo) TableName() string
func (*ReceiveMsgInfo) Update ¶
func (r *ReceiveMsgInfo) Update() error
type SendMsgInfo ¶
type SendMsgInfo struct { ID string `json:"id" gorm:"primaryKey"` Data string `json:"data" gorm:"type:text;not null"` ClientID string `json:"client_id" gorm:"column:client_id;index;not null"` CommitStatus int `json:"-" gorm:"column:commit_status;default:0"` RetryCount int `json:"-" gorm:"column:retry_count;default:0"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` }
func GetSendMsgInfoForLastTime ¶
func GetSendMsgInfoForLastTime(notInID []string, filterClientID string, MaxRetry, limit int) ([]*SendMsgInfo, error)
func (*SendMsgInfo) Create ¶
func (m *SendMsgInfo) Create() error
func (*SendMsgInfo) TableName ¶
func (m *SendMsgInfo) TableName() string
func (*SendMsgInfo) Update ¶
func (m *SendMsgInfo) Update() error
Click to show internal directories.
Click to hide internal directories.