https://github.com/vchakoshy/graphdb
An open source in memory Graph Database for Social Networks
https://github.com/vchakoshy/graphdb
go golang graph-database in-memory-database social-network
Last synced: about 1 year ago
JSON representation
An open source in memory Graph Database for Social Networks
- Host: GitHub
- URL: https://github.com/vchakoshy/graphdb
- Owner: vchakoshy
- License: gpl-3.0
- Created: 2022-09-17T15:29:58.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-20T14:42:46.000Z (almost 4 years ago)
- Last Synced: 2025-03-28T17:11:40.006Z (about 1 year ago)
- Topics: go, golang, graph-database, in-memory-database, social-network
- Language: Go
- Homepage:
- Size: 3.21 MB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/vchakoshy/graphdb/actions/workflows/go.yml)
# GraphDB
GraphDB is an open source In Memory graph database written in Golang, optimized for social networks.
## Run Server
```bash
go run main.go api
```
rest api http://localhost:8081
grpc server http://localhost:8080
## Client
```bash
go get -u github.com/vchakoshy/graphdb
```
```golang
import "github.com/vchakoshy/graphdb/service"
```
```golang
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)
}
```