Documentation ¶
Index ¶
- func GetAll(conn *sql.DB, isDraft int) (*[]Post, error)
- func GetAllByIds(conn *sql.DB, ids []int) (*[]Post, error)
- type Post
- func Create(conn *sql.DB, title string, content string, slug string, isDraft bool) (Post, error)
- func Delete(conn *sql.DB, id int) (Post, error)
- func GetByID(conn *sql.DB, id int) (*Post, error)
- func GetBySlug(conn *sql.DB, slug string) (*Post, error)
- func Update(conn *sql.DB, id int, title string, content string, slug string, isDraft bool) (Post, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Post ¶
type Post struct { ID int Title string Content string ContentPreview string Slug string IsDraft bool CreatedAt time.Time UpdatedAt time.Time }
Post contains articles and pages used by the CMS
func Update ¶
func Update( conn *sql.DB, id int, title string, content string, slug string, isDraft bool, ) (Post, error)
Update the DB record for a post
func (*Post) GetContentPreview ¶
GetContentPreview strips markdown from the content string, trims and returns it
func (*Post) GetHTMLContent ¶
GetHTMLContent returns the post's markdown content as HTML
Click to show internal directories.
Click to hide internal directories.