Documentation
¶
Index ¶
- type Article
- type ArticleRepo
- func (r *ArticleRepo) Create(ctx context.Context, value *Article) error
- func (r *ArticleRepo) ExistByCond(ctx context.Context, cond map[string]interface{}) (has bool, err error)
- func (r *ArticleRepo) FindOrderByIdAndLimit(ctx context.Context, id uint, limit int) ([]*Article, error)
- func (r *ArticleRepo) GetByCond(ctx context.Context, cond map[string]interface{}) (*Article, error)
- func (r *ArticleRepo) UpdateByIdAndCond(ctx context.Context, id uint, cond map[string]interface{}) error
- type BaseModel
- type User
- type UserRepo
- func (r *UserRepo) Create(ctx context.Context, value *User) error
- func (r *UserRepo) ExistByCond(ctx context.Context, cond map[string]interface{}) (has bool, err error)
- func (r *UserRepo) ExistByEmail(ctx context.Context, email string) (has bool, err error)
- func (r *UserRepo) FindByIds(ctx context.Context, ids []uint) ([]*User, error)
- func (r *UserRepo) FindMapByIds(ctx context.Context, ids []uint) (map[uint]*User, error)
- func (r *UserRepo) GetByCond(ctx context.Context, cond map[string]interface{}) (*User, error)
- func (r *UserRepo) GetByEmail(ctx context.Context, email string) (*User, error)
- func (r *UserRepo) UpdateByIdAndCond(ctx context.Context, id uint, cond map[string]interface{}) error
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 (*ArticleRepo) UpdateByIdAndCond ¶
func (r *ArticleRepo) UpdateByIdAndCond(ctx context.Context, id uint, cond map[string]interface{}) error
UpdateByIdAndCond 根据id和条件更新.
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 (*UserRepo) ExistByCond ¶
func (r *UserRepo) ExistByCond(ctx context.Context, cond map[string]interface{}) (has bool, err error)
ExistByCond 根据条件判断是否存在.
func (*UserRepo) ExistByEmail ¶
func (*UserRepo) FindMapByIds ¶
func (*UserRepo) GetByEmail ¶
Click to show internal directories.
Click to hide internal directories.