storage

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 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
	ThreadsActionable        int64
	ThreadsWaiting           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 DbStorage added in v0.0.31

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

func NewStorage

func NewStorage(logger *slog.Logger) *DbStorage

func (*DbStorage) Bury added in v0.0.31

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

func (*DbStorage) GetPr added in v0.0.31

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

func (*DbStorage) Prs added in v0.0.31

func (s *DbStorage) Prs() StoredState

func (*DbStorage) StoreRepoPrs added in v0.0.31

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

func (*DbStorage) Unbury added in v0.0.31

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

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
	ThreadsActionable        int64
	ThreadsWaiting           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) BuriedPrs added in v0.0.30

func (q *Queries) BuriedPrs(ctx context.Context) ([]string, error)

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 interface {
	Prs() StoredState
	StoreRepoPrs(orderedPrs []types.ViewPr) error
	Bury(prUrl string) error
	Unbury(prUrl string) error
	GetPr(prUrl string) (Pr, error)
}

type StorageDemo added in v0.0.31

type StorageDemo struct{}

func NewStorageDemo added in v0.0.31

func NewStorageDemo() *StorageDemo

func (*StorageDemo) Bury added in v0.0.31

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

func (*StorageDemo) GetPr added in v0.0.31

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

func (*StorageDemo) Prs added in v0.0.31

func (s *StorageDemo) Prs() StoredState

func (*StorageDemo) StoreRepoPrs added in v0.0.31

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

func (*StorageDemo) Unbury added in v0.0.31

func (s *StorageDemo) 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