Documentation ¶
Index ¶
- type GraphStoreService
- func (s *GraphStoreService) AddFriendship(ctx context.Context, friendship internal.Friendship) error
- func (s *GraphStoreService) AddPerson(ctx context.Context, person *internal.Person) error
- func (s *GraphStoreService) GetAll(ctx context.Context) ([]internal.Friendship, error)
- func (s *GraphStoreService) GetDepth(ctx context.Context, first, second int64) (int, error)
- func (s *GraphStoreService) GetFriendship(ctx context.Context, id int64) (internal.Friendship, error)
- func (s *GraphStoreService) GetPerson(ctx context.Context, id int64) (*internal.Person, error)
- func (s *GraphStoreService) Load(ctx context.Context) error
- func (s *GraphStoreService) RemovePerson(ctx context.Context, id int64) error
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 ¶
New initializes a new store.
func (*GraphStoreService) AddFriendship ¶
func (s *GraphStoreService) AddFriendship(ctx context.Context, friendship internal.Friendship) error
func (*GraphStoreService) GetAll ¶
func (s *GraphStoreService) GetAll(ctx context.Context) ([]internal.Friendship, error)
func (*GraphStoreService) GetDepth ¶
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) 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
Click to show internal directories.
Click to hide internal directories.