db

package
v0.1.7 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePasteParams

type CreatePasteParams struct {
	Public    bool        `json:"public"`
	RandID    string      `json:"rand_id"`
	UpdatedAt time.Time   `json:"updated_at"`
	Ip        pqtype.Inet `json:"ip"`
	PasteBlob []byte      `json:"paste_blob"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type ListPublicPastesParams

type ListPublicPastesParams struct {
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type Paste

type Paste struct {
	ID        int64       `json:"id"`
	Public    bool        `json:"public"`
	RandID    string      `json:"rand_id"`
	CreatedAt time.Time   `json:"created_at"`
	UpdatedAt time.Time   `json:"updated_at"`
	PasteBlob []byte      `json:"paste_blob"`
	Ip        pqtype.Inet `json:"ip"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func Prepare

func Prepare(ctx context.Context, db DBTX) (*Queries, error)

func (*Queries) Close

func (q *Queries) Close() error

func (*Queries) CreatePaste

func (q *Queries) CreatePaste(ctx context.Context, arg CreatePasteParams) (Paste, error)

func (*Queries) DeletePasteById added in v0.1.4

func (q *Queries) DeletePasteById(ctx context.Context, id int64) error

func (*Queries) DeletePasteByIp added in v0.1.4

func (q *Queries) DeletePasteByIp(ctx context.Context, ip pqtype.Inet) error

func (*Queries) GetPasteByRandId

func (q *Queries) GetPasteByRandId(ctx context.Context, randID string) (Paste, error)

func (*Queries) ListPublicPastes

func (q *Queries) ListPublicPastes(ctx context.Context, arg ListPublicPastesParams) ([]Paste, error)

func (*Queries) UpdatePaste

func (q *Queries) UpdatePaste(ctx context.Context, arg UpdatePasteParams) (Paste, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type UpdatePasteParams

type UpdatePasteParams struct {
	ID        int64     `json:"id"`
	PasteBlob []byte    `json:"paste_blob"`
	Public    bool      `json:"public"`
	UpdatedAt time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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