db

package
v0.0.0-...-6bd9283 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogDelete

func LogDelete(page *Page) error

func LogEdit

func LogEdit(page *Page) error

func Migrate

func Migrate()

func Open

func Open(dbname string)

Types

type Edit

type Edit struct {
	ID           uint  `gorm:"primaryKey"`
	Editor       *User `gorm:"foreignKey:Username"`
	CreatedAt    time.Time
	PageAffected *Page `gorm:"foreignKey:ID"`
	Content      []byte
	ContentType  string
}

type Page

type Page struct {
	gorm.Model
	Title       string
	Body        []byte
	Rendered    []byte
	ContentType string
}

func LoadPage

func LoadPage(title string) (*Page, error)

func (*Page) Delete

func (p *Page) Delete() error

func (*Page) Edit

func (p *Page) Edit() error

func (*Page) RenderMarkdown

func (p *Page) RenderMarkdown() error

func (*Page) Update

func (p *Page) Update() error

type User

type User struct {
	ID         int64
	Username   string
	Email      string
	CreatedAt  time.Time
	DeletedAt  time.Time
	AccesToken string
}

func (*User) Edit

func (u *User) Edit() error

Jump to

Keyboard shortcuts

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