pastesmodel

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PASTE_KEEP_FOR_MINUTES = 1
	PASTE_KEEP_FOR_HOURS   = 2
	PASTE_KEEP_FOR_DAYS    = 3
	PASTE_KEEP_FOR_MONTHS  = 4
)

Variables

View Source
var (
	PASTE_KEEPS_CORELLATION = map[string]int{
		"M": PASTE_KEEP_FOR_MINUTES,
		"h": PASTE_KEEP_FOR_HOURS,
		"d": PASTE_KEEP_FOR_DAYS,
		"m": PASTE_KEEP_FOR_MONTHS,
	}
)

Functions

This section is empty.

Types

type Paste

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

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