feat: 添加短信验证码发送功能及相关数据库模型
This commit is contained in:
57
backend_v1/database/models/sms_code_sends.gen.go
Normal file
57
backend_v1/database/models/sms_code_sends.gen.go
Normal file
@@ -0,0 +1,57 @@
|
||||
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
|
||||
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
|
||||
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"go.ipao.vip/gen"
|
||||
)
|
||||
|
||||
const TableNameSmsCodeSend = "sms_code_sends"
|
||||
|
||||
// SmsCodeSend mapped from table <sms_code_sends>
|
||||
type SmsCodeSend struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
|
||||
Phone string `gorm:"column:phone;type:character varying(20);not null" json:"phone"`
|
||||
Code string `gorm:"column:code;type:character varying(20);not null" json:"code"`
|
||||
SentAt time.Time `gorm:"column:sent_at;type:timestamp without time zone;not null;default:now()" json:"sent_at"`
|
||||
ExpiresAt time.Time `gorm:"column:expires_at;type:timestamp without time zone;not null" json:"expires_at"`
|
||||
}
|
||||
|
||||
// Quick operations without importing query package
|
||||
// Update applies changed fields to the database using the default DB.
|
||||
func (m *SmsCodeSend) Update(ctx context.Context) (gen.ResultInfo, error) {
|
||||
return Q.SmsCodeSend.WithContext(ctx).Updates(m)
|
||||
}
|
||||
|
||||
// Save upserts the model using the default DB.
|
||||
func (m *SmsCodeSend) Save(ctx context.Context) error { return Q.SmsCodeSend.WithContext(ctx).Save(m) }
|
||||
|
||||
// Create inserts the model using the default DB.
|
||||
func (m *SmsCodeSend) Create(ctx context.Context) error {
|
||||
return Q.SmsCodeSend.WithContext(ctx).Create(m)
|
||||
}
|
||||
|
||||
// Delete removes the row represented by the model using the default DB.
|
||||
func (m *SmsCodeSend) Delete(ctx context.Context) (gen.ResultInfo, error) {
|
||||
return Q.SmsCodeSend.WithContext(ctx).Delete(m)
|
||||
}
|
||||
|
||||
// ForceDelete permanently deletes the row (ignores soft delete) using the default DB.
|
||||
func (m *SmsCodeSend) ForceDelete(ctx context.Context) (gen.ResultInfo, error) {
|
||||
return Q.SmsCodeSend.WithContext(ctx).Unscoped().Delete(m)
|
||||
}
|
||||
|
||||
// Reload reloads the model from database by its primary key and overwrites current fields.
|
||||
func (m *SmsCodeSend) Reload(ctx context.Context) error {
|
||||
fresh, err := Q.SmsCodeSend.WithContext(ctx).GetByID(m.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*m = *fresh
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user