2022-03-12 18:06:39 +00:00
|
|
|
// package models
|
2022-02-23 12:07:09 +00:00
|
|
|
|
2022-03-12 18:06:39 +00:00
|
|
|
// import (
|
|
|
|
// "time"
|
2022-02-23 12:07:09 +00:00
|
|
|
|
2022-03-12 18:06:39 +00:00
|
|
|
// "github.com/jinzhu/gorm"
|
|
|
|
// )
|
2022-02-23 12:07:09 +00:00
|
|
|
|
2022-03-12 18:06:39 +00:00
|
|
|
// //Post model
|
|
|
|
// type Post struct {
|
|
|
|
// gorm.Model
|
|
|
|
// Title string
|
|
|
|
// Author string
|
|
|
|
// Published time.Time
|
|
|
|
// LastEdited time.Time
|
|
|
|
// Content []byte
|
|
|
|
// }
|
2022-02-23 12:07:09 +00:00
|
|
|
|
2022-03-12 18:06:39 +00:00
|
|
|
// //Create new post
|
|
|
|
// func (p Post) Create() error {
|
|
|
|
// return create(&p)
|
|
|
|
// }
|
2022-02-23 12:07:09 +00:00
|
|
|
|
2022-03-12 18:06:39 +00:00
|
|
|
// func (p *Post) Read() (*Post, error) {
|
|
|
|
// err := read(&p)
|
|
|
|
// return p, err
|
|
|
|
// }
|
2022-02-23 12:07:09 +00:00
|
|
|
|
2022-03-12 18:06:39 +00:00
|
|
|
// func (p Post) ReadAll() ([]Post, error) {
|
|
|
|
// var posts []Post
|
|
|
|
// err := readAll(&posts)
|
|
|
|
// return posts, err
|
|
|
|
// }
|