model

package
v0.0.0-...-900783e Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile struct {
	gorm.Model
	UserID    uint   `gorm:"uniqueIndex"` // 用户ID
	Nickname  string `gorm:"size:255"`    // 用户昵称
	AvatarURL string `gorm:"size:255"`    // 用户头像URL
}

Profile 定义了用户配置的模型

func (*Profile) BeforeCreate

func (p *Profile) BeforeCreate(tx *gorm.DB) (err error)

BeforeCreate 钩子

func (*Profile) BeforeUpdate

func (p *Profile) BeforeUpdate(tx *gorm.DB) (err error)

BeforeUpdate 钩子

type Repo

type Repo struct {
	DB *gorm.DB
}

Repo 提供用户注册的服务

func NewRepo

func NewRepo(db *gorm.DB) *Repo

NewRepo 创建一个新的RegisterService实例

func (*Repo) UpdateProfileSettings

func (repo *Repo) UpdateProfileSettings(ctx context.Context, userID uint, nickname string, avatarURL string) error

UpdateProfileSettings 创建或者更新用户的昵称和头像URL

Jump to

Keyboard shortcuts

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