db

package
v0.0.0-...-8981f58 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BurnPaste

func BurnPaste(app *config.Application, id string) error

BurnPaste removes a paste with given ID

func ConnectDB

func ConnectDB(app *config.Application)

func LinkIDExists

func LinkIDExists(app *config.Application, id string) bool

LinkIDExists returns true when id exists

func NewDrop

func NewDrop(app *config.Application, id string, title string, filename string) error

NewDrop is the db operation to create a new file drop in database

func NewLink(app *config.Application, id string, completeLink string) error

NewLink is the db operation to create a new shortened url in database

func NewPaste

func NewPaste(app *config.Application, id string, title string, content string, expiry string, password string, burn int) error

NewPaste is the db operation to create a new paste in database

Types

type FileDrop

type FileDrop struct {
	ID       string `db:"id"`
	Title    string `db:"title"`
	Created  string `db:"created"`
	FileName string `db:"filename"`
	Preview  string
}

FileDrop is struct to resemble 'file_drops' table

func GetDrop

func GetDrop(app *config.Application, id string) (FileDrop, error)

GetDrop is the db operation to fetch details for the file drop

type Paste

type Paste struct {
	ID              string `db:"id"`
	Title           string `db:"title"`
	Content         string `db:"content"`
	Password        string `db:"password"`
	Preview         string // One of `markdown`, `code` and `plain`.
	PreviewLanguage string // Code preview language extension.
	ContentHTML     template.HTML
	Expiry          string `db:"expiry"`
	Created         string `db:"created"`
	Burn            int    `db:"burn"`
}

Paste symbolizes a single paste

func GetPaste

func GetPaste(app *config.Application, id string) (Paste, error)

GetPaste is the db operation to fetch a single paste

type ShortenedLink struct {
	ID           string `db:"id"`
	CompleteLink string `db:"complete_link"`
	Created      string `db:"created"`
}

ShortenedLink is struct to resemble 'shortened_links' table

func GetLink(app *config.Application, id string) (ShortenedLink, error)

GetLink is the db operation to fetch expanded url for shortened url

Jump to

Keyboard shortcuts

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