graph

package
v0.0.0-...-13e599b Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GraphStoreService

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

Store is a bi-directional graph ds representing relation-ships between people.

func NewGraphStore

func NewGraphStore(db *sql.DB, repo service.Store, cache service.Cache) *GraphStoreService

New initializes a new store.

func (*GraphStoreService) AddFriendship

func (s *GraphStoreService) AddFriendship(ctx context.Context, friendship internal.Friendship) error

func (*GraphStoreService) AddPerson

func (s *GraphStoreService) AddPerson(ctx context.Context, person *internal.Person) error

func (*GraphStoreService) GetAll

func (*GraphStoreService) GetDepth

func (s *GraphStoreService) GetDepth(ctx context.Context, first, second int64) (int, error)

FindDepth uses bfs to find the depth distance between to people, if not related id will be -1.

returns ENOTFOUND if one of the people arent found.

func (*GraphStoreService) GetFriendship

func (s *GraphStoreService) GetFriendship(ctx context.Context, id int64) (internal.Friendship, error)

func (*GraphStoreService) GetPerson

func (s *GraphStoreService) GetPerson(ctx context.Context, id int64) (*internal.Person, error)

func (*GraphStoreService) Load

func (s *GraphStoreService) Load(ctx context.Context) error

Load, syncs the store with the database.

should only be used once after initialization.

func (*GraphStoreService) RemovePerson

func (s *GraphStoreService) RemovePerson(ctx context.Context, id int64) error

Jump to

Keyboard shortcuts

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