data

package
v0.0.0-...-046bdf9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 17 Imported by: 0

README

Data

Documentation

Index

Constants

View Source
const (
	SendEmailWait = iota
	SendEmailSuccess
	SendEmailFail
)
View Source
const (
	SendSmsWait = iota
	SendSmsSuccess
	SendSmsFail
)
View Source
const AsyncSendEmail = 2 // 异步
View Source
const AsyncSendSms = 2 // 异步
View Source
const SyncSendEmail = 1 // 同步
View Source
const SyncSendSms = 1 // 同步

Variables

ProviderSet is data providers.

Functions

func NewDiscovery

func NewDiscovery(conf *conf.Registry) registry.Discovery

func NewEmailRepo

func NewEmailRepo(data *Data, logger log.Logger) biz.EmailRepo

func NewMysqlCmd

func NewMysqlCmd(conf *conf.Bootstrap, logger log.Logger) *gorm.DB

func NewRedisCmd

func NewRedisCmd(conf *conf.Data, logger log.Logger) *redis.Client

func NewRegistrar

func NewRegistrar(conf *conf.Registry) registry.Registrar

func NewSmsRepo

func NewSmsRepo(data *Data, logger log.Logger) biz.SmsRepo

Types

type BaseFields

type BaseFields struct {
	Id int64 `gorm:"primarykey;autoIncrement;type:int;comment:主键id"`
}

type Data

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

Data .

func NewData

func NewData(cfg *conf.Bootstrap, db *gorm.DB, redisCli *redis.Client, logger log.Logger) (*Data, func(), error)

NewData .

type EmailEntity

type EmailEntity struct {
	BaseFields
	UserID  uint   `gorm:"not null;type:int(10) unsigned;comment:'用户id'"`
	Address string `gorm:"not null;type:varchar(255);comment:'邮箱地址'"`
	Subject string `gorm:"not null;type:varchar(255);comment:'主题'"`
	Content string `gorm:"not null;type:text;comment:'内容'"`
	Type    uint8  `gorm:"not null;default:1;type:tinyint(1) unsigned;comment:'1 同步 2 异步'"`
	Status  uint8  `gorm:"not null;default:0;type:tinyint(1) unsigned;comment:'状态0 未发送 1 成功 2 失败'"`
}

func (EmailEntity) TableName

func (EmailEntity) TableName() string

type EmailRepo

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

func (EmailRepo) SendEmail

func (s EmailRepo) SendEmail(ctx context.Context, email string, subject, content string) error

type SmsEntity

type SmsEntity struct {
	BaseFields
	SignName     string
	TemplateCode string
	Mobile       string
	Content      string
	Type         int64
	Status       int64
	ErrReason    string
}

func (SmsEntity) TableName

func (SmsEntity) TableName() string

type SmsRepo

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

func (SmsRepo) SendSmsVerifyCode

func (s SmsRepo) SendSmsVerifyCode(ctx context.Context, mobile string, sendType int64) (int64, int64, string, error)

Jump to

Keyboard shortcuts

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