Documentation ¶
Index ¶
- func CreateArticle(article *Article) error
- func CreateComment(comment *Comment) error
- func DeleteArticleByID(id uint64) error
- func DeleteCommentByID(id uint64) error
- func EditArticleByID(article *Article, id uint64) error
- func EditCommentByID(comment *Comment, id uint64) error
- func InitializeDb(user string, password string, host string, name string, port int)
- func LoadFixtures()
- func MakeMigrations()
- type Article
- type Comment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateArticle ¶
CreateArticle creates an article row in database
func CreateComment ¶
CreateComment creates an comment row in database
func DeleteArticleByID ¶
DeleteArticleByID allows you to remove an article from the db using its id
func DeleteCommentByID ¶
DeleteCommentByID allows you to remove an comment from the db using its id
func EditArticleByID ¶
EditArticleByID allow you to modify an article using its id
func EditCommentByID ¶
EditCommentByID allow you to modify an comment using its id
func InitializeDb ¶
InitializeDb connects to database
Types ¶
type Article ¶
type Article struct { ID uint64 `gorm:"primary_key"` Title string `gorm:"size:255;unique;not null"` Content string `gorm:"size:2000"` //Published bool `gorm:"default:false"` Comments []Comment `gorm:"foreignkey:ArticleId"` CreatedAt time.Time UpdatedAt time.Time }
Article is user post in the wiki
func FindArticleByID ¶
FindArticleByID allows you to find a specific article using its id
func FindArticleByName ¶
func FindArticles ¶
FindArticles returns you a list of articles
type Comment ¶
type Comment struct { ID uint64 `gorm:"primary_key"` Text string `gorm:"size:500"` ArticleId uint64 CreatedAt time.Time UpdatedAt time.Time }
Comment is user post in the wiki
func FindCommentByID ¶
FindCommentByID allows you to find a specific comment using its id
func FindComments ¶
FindComments returns you a list of comments