structs

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PasteKeepForever indicates that paste should be kept forever.
	PasteKeepForever = 0
	// PasteKeepForMinutes indicates that saved timeout is in minutes.
	PasteKeepForMinutes = 1
	// PasteKeepForHours indicates that saved timeout is in hours.
	PasteKeepForHours = 2
	// PasteKeepForDays indicates that saved timeout is in days.
	PasteKeepForDays = 3
	// PasteKeepForMonths indicates that saved timeout is in months.
	PasteKeepForMonths = 4
)

Variables

View Source
var PasteKeepsCorrelation = map[string]int{
	"M":       PasteKeepForMinutes,
	"h":       PasteKeepForHours,
	"d":       PasteKeepForDays,
	"m":       PasteKeepForMonths,
	"forever": PasteKeepForever,
}

PasteKeepsCorrelation is a correlation map between database representation and passed data representation.

Functions

This section is empty.

Types

type Paste

type Paste struct {
	CreatedAt       *time.Time `db:"created_at" json:"created_at"`
	Title           string     `db:"title" json:"title"`
	Data            string     `db:"data" json:"data"`
	Language        string     `db:"language" json:"language"`
	Password        string     `db:"password" json:"password"`
	PasswordSalt    string     `db:"password_salt" json:"password_salt"`
	ID              int        `db:"id" json:"id"`
	KeepFor         int        `db:"keep_for" json:"keep_for"`
	KeepForUnitType int        `db:"keep_for_unit_type" json:"keep_for_unit_type"`
	Private         bool       `db:"private" json:"private"`
}

Paste represents paste itself.

func (*Paste) CreatePassword

func (p *Paste) CreatePassword(password string) error

CreatePassword creates password for current paste.

func (*Paste) GenerateCryptedCookieValue

func (p *Paste) GenerateCryptedCookieValue() string

GenerateCryptedCookieValue generates crypted cookie value for paste.

func (*Paste) GetExpirationTime

func (p *Paste) GetExpirationTime() time.Time

func (*Paste) IsExpired

func (p *Paste) IsExpired() bool

IsExpired checks if paste is already expired (or not).

func (*Paste) VerifyPassword

func (p *Paste) VerifyPassword(password string) bool

VerifyPassword verifies that provided password is valid.

Jump to

Keyboard shortcuts

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