stars

package
v0.0.0-...-dd36d75 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultLabel is stars graph default label.
	DefaultLabel = "GitHubStars"
	// OwnedByEdgeLabel is a label for repo owner edge.
	OwnedByEdgeLabel = "OwnedBy"
	// IsLangEdgeLabel is a label for repo language edge.
	IsLangEdgeLabel = "IsLanguage"
	// HasTopicEdgeLabel is a label for repo topic edge.
	HasTopicEdgeLabel = "HasTopic"
)
View Source
const (
	// DefaultStyleType is default style type.
	DefaultStyleType = "filling"
	// OwnerShape is default owner node shape.
	OwnerShape = "hexagon"
	// RepoShape is default repo node shape.
	RepoShape = "diamond"
	// TopicShape is default topic node shape.
	TopicShape = "ellipse"
	// LangShape is default lang node shape.
	LangShape = "square"
	// LinkShape is default link shape.
	LinkShape = "normal"
	// UnknownShape is unknown shape.
	UnknownShape = "unknown"
)
View Source
const (
	// DefaultWeight is default edge weight.
	DefaultWeight = 1.0
)

Variables

View Source
var (
	// OwnerColor is default owner node color.
	OwnerColor = color.RGBA{R: 245, G: 154, B: 240}
	// RepoColor is default repo node color.
	RepoColor = color.RGBA{R: 0, G: 255, B: 153}
	// TopicColor is default topic node color.
	TopicColor = color.RGBA{R: 153, G: 153, B: 255}
	// LangColor is default lang node color.
	LangColor = color.RGBA{R: 255, G: 133, B: 102}
	// LinkColor is default link color.
	LinkColor = color.RGBA{R: 0, G: 0, B: 0}
	// UnknownColor is default color for unknown entity.
	UnknownColor = color.RGBA{R: 255, G: 255, B: 255}
)

Functions

func LangAttrs

func LangAttrs(lang string) map[string]interface{}

func LinkAttrs

func LinkAttrs(rel string, weight float64) map[string]interface{}

func OwnerAttrs

func OwnerAttrs(owner *github.User) (map[string]interface{}, error)

func RepoAttrs

func RepoAttrs(repo *github.Repository, starredAt *github.Timestamp) (map[string]interface{}, error)

func TopicAttrs

func TopicAttrs(topic string) map[string]interface{}

Types

type Entity

type Entity int

Entity is a GitHub stars graph entity

const (
	OwnerEntity Entity = iota
	RepoEntity
	TopicEntity
	LangEntity
	LinkEntity
)

func (Entity) DefaultStyle

func (e Entity) DefaultStyle() style.Style

DefaultStyle returns default style.Style.

func (Entity) String

func (e Entity) String() string

String implements fmt.Stringer

type Stars

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

Stars builds GitHub stars graph.

func NewBuilder

func NewBuilder(g graph.Adder) (*Stars, error)

NewBuilder creates a new GH stars graph builder and returns it.

func (*Stars) Build

func (s *Stars) Build(ctx context.Context, reposChan <-chan interface{}) error

Build builds a graph by adding nodes and edges from the data received on repos channel.

Jump to

Keyboard shortcuts

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