Documentation ¶
Index ¶
- Constants
- func Close(db *gorm.DB) error
- func NewDBEngine(databaseSetting *setting.DatabaseSettingS) (*gorm.DB, error)
- type ArticleDao
- type ArticleDaoDB
- func (d *ArticleDaoDB) CountArticleListByTagID(id uint32, state uint8) (int64, error)
- func (d *ArticleDaoDB) CreateArticle(title string, desc string, content string, image string, state uint8, ...) (*ArticleModel, error)
- func (d *ArticleDaoDB) DeleteArticle(id uint32) error
- func (d *ArticleDaoDB) GetArticle(id uint32, state uint8) (ArticleModel, error)
- func (d *ArticleDaoDB) GetArticleListByTagID(id uint32, state uint8, page, pageSize int) ([]*ArticleTagRow, error)
- func (d *ArticleDaoDB) UpdateArticle(id uint32, title string, desc string, content string, image string, ...) error
- type ArticleModel
- type ArticleTagDao
- type ArticleTagDaoDB
- func (d *ArticleTagDaoDB) CreateArticleTag(articleID, tagID uint32, createdBy string) error
- func (d *ArticleTagDaoDB) DeleteArticleTag(articleID uint32) error
- func (d *ArticleTagDaoDB) GetArticleTagByAID(articleID uint32) (ArticleTagModel, error)
- func (d *ArticleTagDaoDB) GetArticleTagListByAIDs(articleIDs []uint32) ([]*ArticleTagModel, error)
- func (d *ArticleTagDaoDB) GetArticleTagListByTID(tagID uint32) ([]*ArticleTagModel, error)
- func (d *ArticleTagDaoDB) UpdateArticleTag(articleID, tagID uint32, modifiedBy string) error
- type ArticleTagModel
- type ArticleTagRow
- type Model
- type TagDao
- type TagDaoDB
- func (d *TagDaoDB) CountTag(name string, state uint8) (int64, error)
- func (d *TagDaoDB) CreateTag(name string, state uint8, createdBy string) error
- func (d *TagDaoDB) DeleteTag(id uint32) error
- func (d *TagDaoDB) GetTag(id uint32, state uint8) (TagModel, error)
- func (d *TagDaoDB) GetTagList(name string, state uint8, page, pageSize int) ([]*TagModel, error)
- func (d *TagDaoDB) GetTagListByIDs(ids []uint32, state uint8) ([]*TagModel, error)
- func (d *TagDaoDB) UpdateTag(id uint32, name string, state uint8, modifiedBy string) error
- type TagModel
Constants ¶
View Source
const ( StateOpen = 1 StateClose = 0 )
Variables ¶
This section is empty.
Functions ¶
func NewDBEngine ¶
func NewDBEngine(databaseSetting *setting.DatabaseSettingS) (*gorm.DB, error)
Types ¶
type ArticleDao ¶
type ArticleDao interface { CreateArticle(title string, desc string, content string, image string, state uint8, createdBy string) (*ArticleModel, error) UpdateArticle(id uint32, title string, desc string, content string, image string, state uint8, modifiedBy string) error GetArticle(id uint32, state uint8) (ArticleModel, error) DeleteArticle(id uint32) error CountArticleListByTagID(id uint32, state uint8) (int64, error) GetArticleListByTagID(id uint32, state uint8, page, pageSize int) ([]*ArticleTagRow, error) }
type ArticleDaoDB ¶
type ArticleDaoDB struct {
// contains filtered or unexported fields
}
func NewArticleDaoDB ¶
func NewArticleDaoDB(db *gorm.DB) *ArticleDaoDB
func (*ArticleDaoDB) CountArticleListByTagID ¶
func (d *ArticleDaoDB) CountArticleListByTagID(id uint32, state uint8) (int64, error)
func (*ArticleDaoDB) CreateArticle ¶
func (d *ArticleDaoDB) CreateArticle(title string, desc string, content string, image string, state uint8, createdBy string) (*ArticleModel, error)
func (*ArticleDaoDB) DeleteArticle ¶
func (d *ArticleDaoDB) DeleteArticle(id uint32) error
func (*ArticleDaoDB) GetArticle ¶
func (d *ArticleDaoDB) GetArticle(id uint32, state uint8) (ArticleModel, error)
func (*ArticleDaoDB) GetArticleListByTagID ¶
func (d *ArticleDaoDB) GetArticleListByTagID(id uint32, state uint8, page, pageSize int) ([]*ArticleTagRow, error)
type ArticleModel ¶
type ArticleModel struct { *Model Title string `json:"title"` Desc string `json:"desc"` Content string `json:"content"` CoverImageURL string `json:"cover_image_url"` State uint8 `json:"state"` }
Model to Artile.
func (ArticleModel) TableName ¶
func (ArticleModel) TableName() string
type ArticleTagDao ¶
type ArticleTagDao interface { GetArticleTagByAID(articleID uint32) (ArticleTagModel, error) GetArticleTagListByTID(tagID uint32) ([]*ArticleTagModel, error) GetArticleTagListByAIDs(articleIDs []uint32) ([]*ArticleTagModel, error) CreateArticleTag(articleID, tagID uint32, createdBy string) error UpdateArticleTag(articleID, tagID uint32, modifiedBy string) error DeleteArticleTag(articleID uint32) error }
type ArticleTagDaoDB ¶
type ArticleTagDaoDB struct {
// contains filtered or unexported fields
}
func NewArticleTagDao ¶
func NewArticleTagDao(db *gorm.DB) *ArticleTagDaoDB
func (*ArticleTagDaoDB) CreateArticleTag ¶
func (d *ArticleTagDaoDB) CreateArticleTag(articleID, tagID uint32, createdBy string) error
func (*ArticleTagDaoDB) DeleteArticleTag ¶
func (d *ArticleTagDaoDB) DeleteArticleTag(articleID uint32) error
func (*ArticleTagDaoDB) GetArticleTagByAID ¶
func (d *ArticleTagDaoDB) GetArticleTagByAID(articleID uint32) (ArticleTagModel, error)
TODO: combine single query and batch query.
func (*ArticleTagDaoDB) GetArticleTagListByAIDs ¶
func (d *ArticleTagDaoDB) GetArticleTagListByAIDs(articleIDs []uint32) ([]*ArticleTagModel, error)
func (*ArticleTagDaoDB) GetArticleTagListByTID ¶
func (d *ArticleTagDaoDB) GetArticleTagListByTID(tagID uint32) ([]*ArticleTagModel, error)
func (*ArticleTagDaoDB) UpdateArticleTag ¶
func (d *ArticleTagDaoDB) UpdateArticleTag(articleID, tagID uint32, modifiedBy string) error
type ArticleTagModel ¶
type ArticleTagModel struct { *Model TagID uint32 `json:"tag_id"` ArticleID uint32 `json:"article_id"` }
Model to Artile-Tag.
func (ArticleTagModel) TableName ¶
func (ArticleTagModel) TableName() string
type ArticleTagRow ¶
type ArticleTagRow struct { Article ArticleModel Tag TagModel }
type TagDao ¶
type TagDao interface { GetTag(id uint32, state uint8) (TagModel, error) GetTagList(name string, state uint8, page, pageSize int) ([]*TagModel, error) GetTagListByIDs(ids []uint32, state uint8) ([]*TagModel, error) CountTag(name string, state uint8) (int64, error) CreateTag(name string, state uint8, createdBy string) error UpdateTag(id uint32, name string, state uint8, modifiedBy string) error DeleteTag(id uint32) error }
type TagDaoDB ¶
type TagDaoDB struct {
// contains filtered or unexported fields
}
func (*TagDaoDB) GetTagList ¶
func (*TagDaoDB) GetTagListByIDs ¶
Click to show internal directories.
Click to hide internal directories.