Documentation ¶
Index ¶
- func CheckUserExist(username string) (bool, error)
- func GetIdByUsername(username string) uint
- func NewDBEngine(databaseSetting *setting.DatabaseSettingS) (*gorm.DB, error)
- func TimeStampForUpdateCallback(db *gorm.DB)
- func UpTimestampForCreateCallback(db *gorm.DB)
- type Articles
- func (a *Articles) Count() int64
- func (a *Articles) Create() bool
- func (a *Articles) Delete()
- func (a *Articles) GetTag() *[]Tag
- func (a *Articles) Info() (err error)
- func (a *Articles) List(pageOffset, pageSize int) []*Articles
- func (a *Articles) MarkdownToHtml()
- func (a *Articles) NewCreate(token string) error
- func (a Articles) TableName() string
- func (a *Articles) Update()
- type Auth
- type BaseModel
- type Category
- type Comment
- type Profile
- type Tag
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckUserExist ¶
CheckUserExist 判断用户是否存在 如果存在返回true,不存在返回false
func GetIdByUsername ¶
GetIdByUsername 通过username获取userid
func NewDBEngine ¶
func NewDBEngine(databaseSetting *setting.DatabaseSettingS) (*gorm.DB, error)
Types ¶
type Articles ¶
type Articles struct { BaseModel Title string `json:"title"` // 文章标题 Author string `json:"author"` // 作者 Content string `json:"content"` // 文章内容 //MarkdownUrl string `json:"markdown_url"` // markdown上传后得到的url Tags *[]Tag `gorm:"many2many:articles_tags" json:"tags,omitempty"` // 标签 Category *Category `json:"category,omitempty"` // 分类 UserID uint `json:"user_id,omitempty"` Comments []Comment `json:"comments,omitempty"` // 评论 }
func NewArticles ¶
func NewArticles() Articles
type BaseModel ¶
type BaseModel struct { *gorm.DB `gorm:"-" json:"-"` ID uint `gorm:"primary_key" json:"id,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` // 时间日期直接按照字符串处理即可 UpdatedAt time.Time `json:"updated_at,omitempty"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"` }
BaseModel 创建基本类型
type Comment ¶
type Profile ¶
type User ¶
Click to show internal directories.
Click to hide internal directories.