models

package
v0.0.0-...-313df08 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOAuthClient

func GetOAuthClient(r *http.Request) (*http.Client, error)

func GetOAuthToken

func GetOAuthToken(r *http.Request) (*oauth2.Token, error)

func NewPaste

func NewPaste(r *http.Request, score float64) (string, error)

func SaveOAuthToken

func SaveOAuthToken(w http.ResponseWriter, r *http.Request, token *oauth2.Token) error

Types

type GDriveAPIError

type GDriveAPIError struct {
	Code     int    // The response code we received
	Response string // The response text we received
}

func (*GDriveAPIError) Error

func (e *GDriveAPIError) Error() string

type Paste

type Paste struct {
	PasteID string    `db:"paste_id"`
	UserID  string    `db:"user_id"`
	Title   string    `db:"title"`
	Content []byte    `db:"content"`
	Tags    []string  `db:"tags"`
	Format  string    `db:"format"`
	Date    time.Time `db:"date"`
	Gzip    bool      `db:"gzip"`
	Zlib    bool      `db:"zlib"`

	GDriveID string `db:"gdriveid"`
	GDriveDL string `db:"gdrivedl"`
	// contains filtered or unexported fields
}

func GetPaste

func GetPaste(paste_id string, withContent, withTags bool) (*Paste, error)

func (*Paste) Delete

func (p *Paste) Delete() error

func (*Paste) LinkFromDrive

func (p *Paste) LinkFromDrive(r *http.Request, c *http.Client) (string, error)

func (*Paste) Validate

func (p *Paste) Validate() error

func (*Paste) ZContent

func (p *Paste) ZContent(r *http.Request, pc pasteContent) error

type ValidationError

type ValidationError struct {
	What string // What is invalid
	Why  string // Why is it invalid
}

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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