db

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 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 CreateWallParams added in v0.1.8

type CreateWallParams struct {
	Public    bool        `json:"public"`
	RandID    string      `json:"rand_id"`
	Title     string      `json:"title"`
	UpdatedAt time.Time   `json:"updated_at"`
	Ip        pqtype.Inet `json:"ip"`
}

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 GetPastesByWallParams added in v0.1.8

type GetPastesByWallParams struct {
	WallID int64 `json:"wall_id"`
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type GetPastesByWallRow added in v0.1.8

type GetPastesByWallRow struct {
	WallID    int64       `json:"wall_id"`
	PasteID   int64       `json:"paste_id"`
	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 LinkPasteToWallParams added in v0.1.8

type LinkPasteToWallParams struct {
	WallID  int64 `json:"wall_id"`
	PasteID int64 `json:"paste_id"`
}

type ListPublicPastesParams

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

type ListPublicWallsParams added in v0.1.8

type ListPublicWallsParams 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) CountPastes added in v0.1.12

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

func (*Queries) CountWalls added in v0.1.12

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

func (*Queries) CreatePaste

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

func (*Queries) CreateWall added in v0.1.8

func (q *Queries) CreateWall(ctx context.Context, arg CreateWallParams) (Wall, 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) DeleteWallById added in v0.1.8

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

func (*Queries) DeleteWallsByIp added in v0.1.8

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

func (*Queries) GetPasteByRandId

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

func (*Queries) GetPastesByWall added in v0.1.8

func (q *Queries) GetPastesByWall(ctx context.Context, arg GetPastesByWallParams) ([]GetPastesByWallRow, error)

func (*Queries) GetWallByRandId added in v0.1.8

func (q *Queries) GetWallByRandId(ctx context.Context, randID string) (Wall, error)

func (*Queries) LinkPasteToWall added in v0.1.8

func (q *Queries) LinkPasteToWall(ctx context.Context, arg LinkPasteToWallParams) (WallsPaste, error)

func (*Queries) ListPublicPastes

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

func (*Queries) ListPublicWalls added in v0.1.8

func (q *Queries) ListPublicWalls(ctx context.Context, arg ListPublicWallsParams) ([]Wall, error)

func (*Queries) SearchPastesByText added in v0.1.11

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

func (*Queries) UpdatePaste

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

func (*Queries) UpdateWall added in v0.1.8

func (q *Queries) UpdateWall(ctx context.Context, arg UpdateWallParams) (Wall, error)

func (*Queries) WithTx

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

type SearchPastesByTextParams added in v0.1.11

type SearchPastesByTextParams struct {
	ConvertTo string `json:"convert_to"`
	Limit     int32  `json:"limit"`
}

type UpdatePasteParams

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

type UpdateWallParams added in v0.1.8

type UpdateWallParams struct {
	ID        int64     `json:"id"`
	Title     string    `json:"title"`
	Public    bool      `json:"public"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Wall added in v0.1.8

type Wall struct {
	ID        int64       `json:"id"`
	Public    bool        `json:"public"`
	RandID    string      `json:"rand_id"`
	Title     string      `json:"title"`
	CreatedAt time.Time   `json:"created_at"`
	UpdatedAt time.Time   `json:"updated_at"`
	Ip        pqtype.Inet `json:"ip"`
}

type WallsPaste added in v0.1.8

type WallsPaste struct {
	WallID  int64 `json:"wall_id"`
	PasteID int64 `json:"paste_id"`
}

Jump to

Keyboard shortcuts

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