graph

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const AppVersion = "0.0.5"
View Source
const DefaultQueryLimit = 10

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	Name string
	From int64
	To   int64
}

type Follow

type Follow struct {
	Data      map[int64]map[int64]Node
	AdjMatrix map[int64]map[int64]bool
}

func NewFollow

func NewFollow() Follow

func (*Follow) Add

func (f *Follow) Add(from, to int64)

func (*Follow) CountAll

func (f *Follow) CountAll() int

func (*Follow) Exists

func (f *Follow) Exists(from, to int64) bool

func (*Follow) Fof

func (f *Follow) Fof(from int64, skip, limit int) map[int64]Node

func (*Follow) FofIds

func (f *Follow) FofIds(from int64, skip, limit int) []int64

func (*Follow) GetLeaders

func (f *Follow) GetLeaders(from int64) []int64

GetLeaders returns the list of users who followed by the current from user

func (*Follow) List

func (f *Follow) List(from int64) ([]int64, error)

func (*Follow) Remove

func (f *Follow) Remove(from, to int64)

func (*Follow) SuggestByUser

func (f *Follow) SuggestByUser(user int64, limit int) []int64

type Graph

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

Graph

func NewGraph

func NewGraph() *Graph

func (*Graph) AddFollow

func (g *Graph) AddFollow(from, to int64) *Graph

func (*Graph) Close

func (g *Graph) Close() error

func (*Graph) GetFollows

func (g *Graph) GetFollows(from int64) ([]int64, error)

func (*Graph) GetFriendsOfFriends

func (g *Graph) GetFriendsOfFriends(from int64) ([]int64, error)

func (*Graph) GetMetrics

func (g *Graph) GetMetrics() Metrics

func (*Graph) Load

func (g *Graph) Load(name string) error

func (*Graph) RemoveFollow

func (g *Graph) RemoveFollow(from, to int64) *Graph

func (*Graph) SetQueryOptions

func (g *Graph) SetQueryOptions(opts QueryOptions) *Graph

func (*Graph) SuggestByUser

func (g *Graph) SuggestByUser(user int64) *Graph

type Metrics

type Metrics struct {
	FollowCount int   `json:"follow_count"`
	WriteCount  int64 `json:"write_count"`
	ReadCount   int64 `json:"read_count"`
}

func (*Metrics) IncReadCount

func (m *Metrics) IncReadCount() *Metrics

func (*Metrics) IncWriteCount

func (m *Metrics) IncWriteCount() *Metrics

type Node

type Node struct{}

type QueryOptions

type QueryOptions struct {
	Limit int
	Skip  int
}

func QueryOptionsDefault

func QueryOptionsDefault() QueryOptions

Jump to

Keyboard shortcuts

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