db

package
v0.0.0-...-fa81d49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateArticle

func CreateArticle(db *sql.DB, title string, content string) error

func CreateDB

func CreateDB(dbPath string)

func CreateDataFolder

func CreateDataFolder(blogDataFolder string, dbPath string)

func CreateTable

func CreateTable(db *sql.DB)

func DeleteArticle

func DeleteArticle(db *sql.DB, articleId string) error

func OpenDB

func OpenDB(dbPath string) (*sql.DB, error)

func UpdateArticle

func UpdateArticle(db *sql.DB, articleId string, title string, content string) error

Types

type Article

type Article struct {
	ID      int           `json:"id"`
	Title   string        `json:"title"`
	Content template.HTML `json:"content"`
}

func GetAllArticles

func GetAllArticles(db *sql.DB) ([]*Article, error)

func GetArticle

func GetArticle(db *sql.DB, articleId string) (*Article, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL