storage

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFoundID = errors.New("db: could not find ID")
)

Functions

func InitDB

func InitDB(driverName string, dataSourceName string) error

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool(driverName string, dataSourceName string, maxOpenConns int, maxIdleConns int) (DB, error)

func (DB) Close

func (db DB) Close() error

func (DB) PasteAdd

func (db DB) PasteAdd(paste Paste) (string, int64, int64, error)

func (DB) PasteDelete

func (db DB) PasteDelete(id string) error

func (DB) PasteDeleteExpired

func (db DB) PasteDeleteExpired() (int64, error)

func (DB) PasteGet

func (db DB) PasteGet(id string) (Paste, error)

type Paste

type Paste struct {
	ID         string `json:"id"` // Ignored when creating
	Title      string `json:"title"`
	Body       string `json:"body"`
	CreateTime int64  `json:"createTime"` // Ignored when creating
	DeleteTime int64  `json:"deleteTime"`
	OneUse     bool   `json:"oneUse"`
	Syntax     string `json:"syntax"`

	Author      string `json:"author"`
	AuthorEmail string `json:"authorEmail"`
	AuthorURL   string `json:"authorURL"`
}

Jump to

Keyboard shortcuts

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