model

package
v0.0.0-...-3414fa2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = sqlx.ErrNotFound

Functions

This section is empty.

Types

type MessageSends

type MessageSends struct {
	Id            uint64         `db:"id"`              // 记录ID
	MessageId     uint64         `db:"message_id"`      // 消�ID
	TemplateId    sql.NullInt64  `db:"template_id"`     // 模�ID
	UserId        uint64         `db:"user_id"`         // 用户ID
	Channel       int64          `db:"channel"`         // ��渠�
	Status        int64          `db:"status"`          // ��状� 1:待�� 2:��中 3:���功 4:��失败
	Error         sql.NullString `db:"error"`           // 错误信�
	RetryCount    int64          `db:"retry_count"`     // �试次数
	NextRetryTime sql.NullTime   `db:"next_retry_time"` // 下次�试时间
	SendTime      sql.NullTime   `db:"send_time"`       // ��时间
	CreatedAt     time.Time      `db:"created_at"`      // 创建时间
	UpdatedAt     time.Time      `db:"updated_at"`      // 更新时间
}

type MessageSendsModel

type MessageSendsModel interface {
	Trans(ctx context.Context, fn func(context context.Context, session sqlx.Session) error) error
	BatchInsert(ctx context.Context, records []*MessageSends) error
	FindByMessageId(ctx context.Context, messageId uint64) ([]*MessageSends, error)
	FindByUserId(ctx context.Context, userId uint64) ([]*MessageSends, error)
	UpdateStatus(ctx context.Context, id uint64, status int64, error string) error
	FindPendingRetry(ctx context.Context, limit int) ([]*MessageSends, error)
	UpdateRetryInfo(ctx context.Context, id uint64, retryCount int64, nextRetryTime time.Time) error
	UpdateSendTime(ctx context.Context, id uint64, sendTime time.Time) error
	FindByStatus(ctx context.Context, status int64, limit int) ([]*MessageSends, error)
	// contains filtered or unexported methods
}

func NewMessageSendsModel

func NewMessageSendsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) MessageSendsModel

NewMessageSendsModel returns a model for the database table.

type MessageTemplates

type MessageTemplates struct {
	Id              uint64         `db:"id"`               // 模�ID
	Code            string         `db:"code"`             // 模�编�
	Name            string         `db:"name"`             // 模��称
	TitleTemplate   string         `db:"title_template"`   // 标题模�
	ContentTemplate string         `db:"content_template"` // 内容模�
	Type            int64          `db:"type"`             // 消�类型
	Channels        string         `db:"channels"`         // ��渠�
	Config          sql.NullString `db:"config"`           // 渠��置
	Status          int64          `db:"status"`           // 状� 1:�用 2:�用
	CreatedAt       time.Time      `db:"created_at"`       // 创建时间
	UpdatedAt       time.Time      `db:"updated_at"`       // 更新时间
}

type MessageTemplatesModel

type MessageTemplatesModel interface {
	Trans(ctx context.Context, fn func(context context.Context, session sqlx.Session) error) error
	FindByCode(ctx context.Context, code string) (*MessageTemplates, error)
	ListByTypeAndStatus(ctx context.Context, templateType, status int64, page, pageSize int) ([]*MessageTemplates, error)
	CountByTypeAndStatus(ctx context.Context, templateType, status int64) (int64, error)
	UpdateStatus(ctx context.Context, id uint64, status int64) error
	// contains filtered or unexported methods
}

func NewMessageTemplatesModel

func NewMessageTemplatesModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) MessageTemplatesModel

type Messages

type Messages struct {
	Id          uint64         `db:"id"`           // 消�ID
	UserId      uint64         `db:"user_id"`      // 用户ID
	Title       string         `db:"title"`        // 消�标题
	Content     string         `db:"content"`      // 消�内容
	Type        int64          `db:"type"`         // 消�类型 1:系统通知 2:订�消� 3:活动消� 4:物�消�
	SendChannel int64          `db:"send_channel"` // ��渠� 1:站内信 2:短信 3:邮件 4:APP推�
	ExtraData   sql.NullString `db:"extra_data"`   // �外数�
	IsRead      int64          `db:"is_read"`      // 是�已读
	ReadTime    sql.NullTime   `db:"read_time"`    // 阅读时间
	CreatedAt   time.Time      `db:"created_at"`   // 创建时间
}

type MessagesModel

type MessagesModel interface {
	Trans(ctx context.Context, fn func(context context.Context, session sqlx.Session) error) error
	BatchInsert(ctx context.Context, messages []*Messages) error
	FindByUserId(ctx context.Context, userId uint64, messageType int64, unreadOnly bool, page, pageSize int) ([]*Messages, error)
	CountByUserId(ctx context.Context, userId uint64, messageType int64, unreadOnly bool) (int64, error)
	UpdateReadStatus(ctx context.Context, id, userId uint64) error
	DeleteByUserMessage(ctx context.Context, id, userId uint64) error
	// contains filtered or unexported methods
}

func NewMessagesModel

func NewMessagesModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) MessagesModel

type NotificationSettings

type NotificationSettings struct {
	Id        uint64    `db:"id"`         // 设置ID
	UserId    uint64    `db:"user_id"`    // 用户ID
	Type      int64     `db:"type"`       // 消�类型
	Channel   int64     `db:"channel"`    // 通知渠�
	IsEnabled int64     `db:"is_enabled"` // 是��用
	CreatedAt time.Time `db:"created_at"` // 创建时间
	UpdatedAt time.Time `db:"updated_at"` // 更新时间
}

type NotificationSettingsModel

type NotificationSettingsModel interface {
	Trans(ctx context.Context, fn func(context context.Context, session sqlx.Session) error) error
	FindByUserId(ctx context.Context, userId uint64) ([]*NotificationSettings, error)
	FindByUserIdAndType(ctx context.Context, userId uint64, tp int64) ([]*NotificationSettings, error)
	BatchUpsert(ctx context.Context, data []*NotificationSettings) error
	UpdateSettings(ctx context.Context, userId uint64, tp, channel int64, isEnabled bool) error
	// contains filtered or unexported methods
}

func NewNotificationSettingsModel

func NewNotificationSettingsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) NotificationSettingsModel

Jump to

Keyboard shortcuts

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