storage

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreatePrParams

type CreatePrParams struct {
	Url                      string
	ReviewStatus             string
	Title                    string
	Author                   string
	RepoName                 string
	RepoOwner                string
	RepoUrl                  string
	IsDraft                  bool
	LastUpdated              string
	LastPrCommenter          string
	UnrespondedThreads       int64
	Additions                int64
	Deletions                int64
	ReviewRequestedFromUsers string
	Buried                   bool
}

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 Meta

type Meta struct {
	Key   string
	Value string
}

type Pr

type Pr struct {
	Url                      string
	ReviewStatus             string
	Title                    string
	Author                   string
	RepoName                 string
	RepoOwner                string
	RepoUrl                  string
	IsDraft                  bool
	LastUpdated              string
	LastPrCommenter          string
	UnrespondedThreads       int64
	Additions                int64
	Deletions                int64
	ReviewRequestedFromUsers string
	Buried                   bool
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) Bury

func (q *Queries) Bury(ctx context.Context, url string) error

func (*Queries) CreatePr

func (q *Queries) CreatePr(ctx context.Context, arg CreatePrParams) (Pr, error)

func (*Queries) DeletePrs

func (q *Queries) DeletePrs(ctx context.Context) error

func (*Queries) GetLastFetched

func (q *Queries) GetLastFetched(ctx context.Context) (string, error)

func (*Queries) GetPr

func (q *Queries) GetPr(ctx context.Context, url string) (Pr, error)

func (*Queries) ListPrs

func (q *Queries) ListPrs(ctx context.Context) ([]Pr, error)

func (*Queries) StoreLastFetched

func (q *Queries) StoreLastFetched(ctx context.Context, value string) error

func (*Queries) Unbury

func (q *Queries) Unbury(ctx context.Context, url string) error

func (*Queries) WithTx

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

type Storage

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

func NewStorage

func NewStorage(logger *slog.Logger) *Storage

func (*Storage) Bury

func (s *Storage) Bury(prUrl string) error

func (*Storage) GetPr

func (s *Storage) GetPr(prUrl string) (Pr, error)

func (*Storage) Prs

func (s *Storage) Prs() StoredState

func (*Storage) StoreRepoPrs

func (s *Storage) StoreRepoPrs(orderedPrs []types.ViewPr) error

func (*Storage) Unbury

func (s *Storage) Unbury(prUrl string) error

type StoredState

type StoredState struct {
	Prs         []types.ViewPr
	LastFetched time.Time
}

Jump to

Keyboard shortcuts

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