Documentation
¶
Index ¶
- Variables
- func InitTables(db *gorm.DB)
- type Article
- type ArticleDao
- type GormArticleDao
- func (d *GormArticleDao) GetByArtId(ctx context.Context, id int64) (Article, error)
- func (d *GormArticleDao) Insert(ctx context.Context, article Article) (int64, error)
- func (d *GormArticleDao) List(ctx context.Context, id int64, offset int, limit int) ([]Article, error)
- func (d *GormArticleDao) Sync(ctx context.Context, article Article) (int64, error)
- func (d *GormArticleDao) SyncStatus(ctx context.Context, article Article) error
- func (d *GormArticleDao) UpdateById(ctx context.Context, article Article) error
- func (d *GormArticleDao) Upsert(ctx context.Context, article PublishArticle) (int64, error)
- type GormUserDao
- func (dao *GormUserDao) Edit(ctx context.Context, u User) error
- func (dao *GormUserDao) FindByEmail(ctx context.Context, email string) (User, error)
- func (dao *GormUserDao) FindById(ctx context.Context, id int64) (User, error)
- func (dao *GormUserDao) FindByPhone(ctx context.Context, phone string) (User, error)
- func (dao *GormUserDao) Insert(ctx context.Context, u User) error
- type PublishArticle
- type User
- type UserDao
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicateEmail = errors.New("邮箱冲突") ErrUserNotFound = gorm.ErrRecordNotFound )
Functions ¶
func InitTables ¶
Types ¶
type ArticleDao ¶
type ArticleDao interface {
Insert(ctx context.Context, article Article) (int64, error)
UpdateById(ctx context.Context, article Article) error
Sync(ctx context.Context, article Article) (int64, error)
Upsert(ctx context.Context, article PublishArticle) (int64, error)
SyncStatus(ctx context.Context, article Article) error
List(ctx context.Context, id int64, offset int, limit int) ([]Article, error)
GetByArtId(ctx context.Context, id int64) (Article, error)
}
func NewArticleDao ¶
func NewArticleDao(db *gorm.DB) ArticleDao
type GormArticleDao ¶
type GormArticleDao struct {
// contains filtered or unexported fields
}
func (*GormArticleDao) GetByArtId ¶
func (*GormArticleDao) SyncStatus ¶
func (d *GormArticleDao) SyncStatus(ctx context.Context, article Article) error
func (*GormArticleDao) UpdateById ¶
func (d *GormArticleDao) UpdateById(ctx context.Context, article Article) error
func (*GormArticleDao) Upsert ¶
func (d *GormArticleDao) Upsert(ctx context.Context, article PublishArticle) (int64, error)
type GormUserDao ¶
type GormUserDao struct {
// contains filtered or unexported fields
}
func (*GormUserDao) FindByEmail ¶
func (*GormUserDao) FindByPhone ¶
type PublishArticle ¶
type PublishArticle struct {
Article
}
type UserDao ¶
type UserDao interface {
Insert(ctx context.Context, u User) error
FindByEmail(ctx context.Context, email string) (User, error)
FindById(ctx context.Context, id int64) (User, error)
FindByPhone(ctx context.Context, phone string) (User, error)
Edit(ctx context.Context, u User) error
}
func NewUserDao ¶
Click to show internal directories.
Click to hide internal directories.