graphdb

command module
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: 1 Imported by: 0

README

Go

GraphDB

GraphDB is an open source In Memory graph database written in Golang, optimized for social networks.

Run Server

go run main.go api

rest api http://localhost:8081

grpc server http://localhost:8080

Client

go get -u github.com/vchakoshy/graphdb
import "github.com/vchakoshy/graphdb/service"
var opts []grpc.DialOption{
    grpc.WithTransportCredentials(insecure.NewCredentials()),
}

conn, err := grpc.Dial("127.0.0.1:8080", opts...)
if err != nil {
    log.Fatal(err)
}
defer conn.Close()

client := service.NewGraphdbClient(conn)
ctx := context.Background()

// add follow items
client.AddFollow(ctx, &service.Follow{From: 1, To: 2})
client.AddFollow(ctx, &service.Follow{From: 2, To: 3})
client.AddFollow(ctx, &service.Follow{From: 2, To: 4})
client.AddFollow(ctx, &service.Follow{From: 2, To: 5})

// Get friends of friends 
res, err := client.GetFriendsOfFriends(ctx, &service.User{Id: 1})
if err != nil {
    panic(err)
}
for _, i := range res.GetUsers() {
    log.Println("fof of ", 1, "is", i)
}

Documentation

Overview

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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