Documentation
¶
Index ¶
- func CheckLogin(username string, password string) bool
- func CheckLoginValidator(username string, password string, c echo.Context) (bool, error)
- func CreateUser(username string, password string, firstname string, lastname string) models.User
- func GetUser(username string) models.User
- func GrabPost(postURL string) models.Post
- func GrabPosts() []models.Post
- func Login(c echo.Context) error
- func NewPost(post models.Post) models.Post
- func Setup() int
- func UpdatePost(post models.Post) models.Post
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLogin ¶
CheckLogin checks user and pwd and returns boolean
func CheckLoginValidator ¶
CheckLoginValidator checks user and pwd and returns boolean
func CreateUser ¶
CreateUser in database and return a struct with it
func GrabPosts ¶
GrabPosts and relay
func GrabPosts() []models.Post {
db := createConn()
defer db.Close()
posts := []models.Post{}
rows, err := db.Query(`SELECT * FROM posts ORDER BY posted DESC LIMIT 10 OFFSET $1`, 0)
if err != nil {
log.Fatal(err)
}
for rows.Next() {
var row models.Post
err := rows.Scan(&row.ID, &row.Author, &row.Posted, &row.Updated, &row.Title, &row.Content, &row.Status, &row.URL, &row.Excerpt, &row.Meta)
if err != nil {
log.Fatal(err)
}
posts = append(posts, row)
}
return posts
}
GrabPosts and transform to json and send
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.