stars

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const StoreFilename = "stargazers.json"

Variables

This section is empty.

Functions

func Scan added in v0.3.0

func Scan(ctx context.Context, user string, c Client, s *NotifyingStore) error

Scan retrieves all repositories for the user, gets the stars for each repository and adds new ones to the Store.

Types

type Client

type Client interface {
	Stargazers(context.Context, string) ([]github.Stargazer, error)
}

type Notifier

type Notifier interface {
	Notify(ctx context.Context, added bool, stars ...github.Stargazer)
}

Notifier notifies about added/removed stargazers.

type Notifiers

type Notifiers []Notifier

Notifiers is a collection of Notifiers.

func (Notifiers) Notify

func (n Notifiers) Notify(ctx context.Context, added bool, stars ...github.Stargazer)

Notify notifies all Notifiers.

type NotifyingStore added in v0.3.0

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

NotifyingStore is a Store that notifies a Notifier when stargazers are added or removed.

func NewNotifyingStore added in v0.3.0

func NewNotifyingStore(databaseDirectory string, notifiers Notifier) (*NotifyingStore, error)

NewNotifyingStore creates a new NotifyingStore.

func (NotifyingStore) Add added in v0.3.0

func (s NotifyingStore) Add(ctx context.Context, stars ...github.Stargazer) error

Add adds new stargazers to a repository. Notifies the Notifier if there were any new stargazers.

func (NotifyingStore) Delete added in v0.3.0

func (s NotifyingStore) Delete(ctx context.Context, stars ...github.Stargazer) error

Delete removes stargazers from a repository. Notifies the Notifier if there were any removed stargazers.

func (NotifyingStore) Set added in v0.3.1

func (s NotifyingStore) Set(ctx context.Context, stars []github.Stargazer) error

Set updates the store to the provided stargazers. Notifies the Notifier if there were any new or removed stargazers.

type SlackNotifier added in v0.3.0

type SlackNotifier struct {
	// WebHookURL is the URL to the Slack webhook
	WebHookURL string
	// MaximumUsers is the maximum number of users to notify about. Default is 5.
	// If the number of stargazers is greater than this, SlackNotifier only notifies the number of users.
	MaximumUsers int
}

SlackNotifier is a Notifier that posts added/removed stargazers to a Slack channel.

func (SlackNotifier) Notify added in v0.3.0

func (s SlackNotifier) Notify(ctx context.Context, added bool, stars ...github.Stargazer)

type SlogNotifier added in v0.3.0

type SlogNotifier struct{}

SlogNotifier is a Notifier that logs the added/removed stargazers to a slog.Logger stored in the context.

func (SlogNotifier) Notify added in v0.3.0

func (s SlogNotifier) Notify(ctx context.Context, added bool, stars ...github.Stargazer)

type Store

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

Store contains all stars for all repositories

func NewStore added in v0.3.0

func NewStore(databasePath string) (store *Store, err error)

NewStore creates a new Store

func (*Store) Add

func (s *Store) Add(stargazers ...github.Stargazer) ([]github.Stargazer, error)

Add adds new stargazers to a repository. Returns the new stargazers and an error if there was a problem saving the store to disk.

func (*Store) Delete added in v0.3.0

func (s *Store) Delete(stargazer ...github.Stargazer) ([]github.Stargazer, error)

Delete removes stargazers from a repository. Returns the removed stargazers and an error if there was a problem saving the store to disk.

func (*Store) Set added in v0.3.1

func (s *Store) Set(stargazers []github.Stargazer) ([]github.Stargazer, []github.Stargazer, error)

Set updates the store to exactly match the provided stargazers per repository. It returns the stargazers that were added and those that were removed.

Jump to

Keyboard shortcuts

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