db

package
v0.0.0-...-250b907 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*StoredPack)

func WithID

func WithID(id int64) Option

func WithName

func WithName(name string) Option

func WithPublic

func WithPublic(isPublic bool) Option

func WithThumbnail

func WithThumbnail(thumbnailID string) Option

func WithTitle

func WithTitle(title string) Option

func WithUserID

func WithUserID(userID int64) Option

type PackResponse

type PackResponse struct {
	ID          int64  `json:"id"`
	Title       string `json:"title"`
	Name        string `json:"name"`
	ThumbnailID string `json:"thumbnail_id"`
}

func (*PackResponse) ScanRow

func (s *PackResponse) ScanRow(rows *sql.Rows) error

type Postgres

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

func NewPostgres

func NewPostgres() *Postgres

func (*Postgres) AddStickerpack

func (p *Postgres) AddStickerpack(pack *StoredPack) (*PackResponse, error)

func (*Postgres) DeleteMissingPack

func (p *Postgres) DeleteMissingPack(name string) error

func (*Postgres) DeletePack

func (p *Postgres) DeletePack(name string, userID int64) error

func (*Postgres) GetPack

func (p *Postgres) GetPack(name string) (*PackResponse, error)

func (*Postgres) IsPackOwner

func (p *Postgres) IsPackOwner(name string, userID int64) (bool, error)

func (*Postgres) IsPackPublic

func (p *Postgres) IsPackPublic(name string) (bool, error)

func (*Postgres) NameExists

func (p *Postgres) NameExists(name string) (bool, error)

func (Postgres) PublicPacksCount

func (p Postgres) PublicPacksCount() (int, error)

func (Postgres) PublicStickerpacks

func (p Postgres) PublicStickerpacks(page, pageSize int) ([]PackResponse, error)

func (*Postgres) UpdateIsPublic

func (p *Postgres) UpdateIsPublic(name string, isPublic bool) error

func (Postgres) UserPacks

func (p Postgres) UserPacks(userID int64, page, pageSize int) ([]PackResponse, error)

func (Postgres) UserPacksCount

func (p Postgres) UserPacksCount(userID int64) (int, error)

type StoredPack

type StoredPack struct {
	ID          int64
	UserID      int64
	Name        string
	Title       string
	IsPublic    bool
	ThumbnailID string
}

func NewStoredPack

func NewStoredPack(opts ...Option) *StoredPack

Jump to

Keyboard shortcuts

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