data

package
v0.0.0-...-13e8f1d Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	BaseModel
	UserId      uint   `json:"user_id"`
	Title       string `json:"title"`
	Abstract    string `json:"abstract"`
	Content     string `json:"content"`
	IsTop       int32  `json:"is_top"`
	IsPublished int32  `json:"is_published"`
	IsDeleted   int32  `json:"is_deleted"`
}

Article 文章表结构.

type ArticleRepo

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

func NewArticleRepo

func NewArticleRepo(engine *gorm.DB) *ArticleRepo

func (*ArticleRepo) Create

func (r *ArticleRepo) Create(ctx context.Context, value *Article) error

Create .

func (*ArticleRepo) ExistByCond

func (r *ArticleRepo) ExistByCond(ctx context.Context, cond map[string]interface{}) (has bool, err error)

ExistByCond 根据条件判断是否存在.

func (*ArticleRepo) FindOrderByIdAndLimit

func (r *ArticleRepo) FindOrderByIdAndLimit(ctx context.Context, id uint, limit int) ([]*Article, error)

func (*ArticleRepo) GetByCond

func (r *ArticleRepo) GetByCond(ctx context.Context, cond map[string]interface{}) (*Article, error)

GetByCond .

func (*ArticleRepo) UpdateByIdAndCond

func (r *ArticleRepo) UpdateByIdAndCond(ctx context.Context, id uint, cond map[string]interface{}) error

UpdateByIdAndCond 根据id和条件更新.

type BaseModel

type BaseModel struct {
	ID        uint `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type User

type User struct {
	BaseModel
	UserName  string `json:"user_name"`
	NickName  string `json:"nick_name"`
	Uid       string `json:"uid"`
	Email     string `json:"email"`
	Password  string `json:"password"`
	Phone     string `json:"phone"`
	AvatarUrl string `json:"avatar_url"`
	Level     int    `json:"level"`
	IsLocked  int    `json:"is_locked"`
	IsDeleted int    `json:"is_deleted"`
}

User 用户表结构.

type UserRepo

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

func NewUserRepo

func NewUserRepo(engine *gorm.DB) *UserRepo

func (*UserRepo) Create

func (r *UserRepo) Create(ctx context.Context, value *User) error

Create 创建用户.

func (*UserRepo) ExistByCond

func (r *UserRepo) ExistByCond(ctx context.Context, cond map[string]interface{}) (has bool, err error)

ExistByCond 根据条件判断是否存在.

func (*UserRepo) ExistByEmail

func (r *UserRepo) ExistByEmail(ctx context.Context, email string) (has bool, err error)

func (*UserRepo) FindByIds

func (r *UserRepo) FindByIds(ctx context.Context, ids []uint) ([]*User, error)

func (*UserRepo) FindMapByIds

func (r *UserRepo) FindMapByIds(ctx context.Context, ids []uint) (map[uint]*User, error)

func (*UserRepo) GetByCond

func (r *UserRepo) GetByCond(ctx context.Context, cond map[string]interface{}) (*User, error)

GetByCond 根据条件查询用户.

func (*UserRepo) GetByEmail

func (r *UserRepo) GetByEmail(ctx context.Context, email string) (*User, error)

func (*UserRepo) UpdateByIdAndCond

func (r *UserRepo) UpdateByIdAndCond(ctx context.Context, id uint, cond map[string]interface{}) error

UpdateByIdAndCond 根据id和条件更新.

Jump to

Keyboard shortcuts

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