1
1
<div align =" center " >
2
2
3
- [ ![ modus] ( https://github.com/user-attachments/assets/1a6020bd-d041-4dd0-b4a9-ce01dc015b65 )] ( https://github.com/hypermodeinc/modusdb )
3
+ [ ![ modus] ( https://github.com/user-attachments/assets/1a6020bd-d041-4dd0-b4a9-ce01dc015b65 )] ( https://github.com/hypermodeinc/modusgraph )
4
4
5
- [ ![ GitHub License] ( https://img.shields.io/github/license/hypermodeinc/modusdb )] ( https://github.com/hypermodeinc/modusdb ?tab=Apache-2.0-1-ov-file#readme )
5
+ [ ![ GitHub License] ( https://img.shields.io/github/license/hypermodeinc/modusdb )] ( https://github.com/hypermodeinc/modusgraph ?tab=Apache-2.0-1-ov-file#readme )
6
6
[ ![ chat] ( https://img.shields.io/discord/1267579648657850441 )] ( https://discord.gg/NJQ4bJpffF )
7
- [ ![ GitHub Repo stars] ( https://img.shields.io/github/stars/hypermodeinc/modusdb )] ( https://github.com/hypermodeinc/modusdb /stargazers )
8
- [ ![ GitHub commit activity] ( https://img.shields.io/github/commit-activity/m/hypermodeinc/modusdb )] ( https://github.com/hypermodeinc/modusdb /commits/main/ )
7
+ [ ![ GitHub Repo stars] ( https://img.shields.io/github/stars/hypermodeinc/modusdb )] ( https://github.com/hypermodeinc/modusgraph /stargazers )
8
+ [ ![ GitHub commit activity] ( https://img.shields.io/github/commit-activity/m/hypermodeinc/modusdb )] ( https://github.com/hypermodeinc/modusgraph /commits/main/ )
9
9
10
10
</div >
11
11
15
15
<a href =" https://discord.gg/4z4GshR7fq " >Discord</a >
16
16
<p >
17
17
18
- ** ModusDB is a high-performance, transactional database system.** It's designed to be type-first,
19
- schema-agnostic, and portable. ModusDB provides object-oriented APIs that makes it simple to build
18
+ ** modusGraph is a high-performance, transactional database system.** It's designed to be type-first,
19
+ schema-agnostic, and portable. ModusGraph provides object-oriented APIs that make it simple to build
20
20
new apps, paired with support for advanced use cases through the Dgraph Query Language (DQL). A
21
21
dynamic schema allows for natural relations to be expressed in your data with performance that
22
22
scales with your use case.
23
23
24
- ModusDB is available as a Go package for running in-process, providing low-latency reads, writes,
25
- and vector searches. We’ve made trade-offs to prioritize speed and simplicity.
24
+ ModusGraph is available as a Go package for running in-process, providing low-latency reads, writes,
25
+ and vector searches. We’ve made trade-offs to prioritize speed and simplicity. When runnning
26
+ in-process, modusGraph internalizes Dgraph's server components, and data is written to a local
27
+ file-based database. modusGraph also supports remote Dgraph servers, allowing you deploy your apps
28
+ to any Dgraph cluster simply by changing the connection string.
26
29
27
30
The [ modus framework] ( https://github.com/hypermodeinc/modus ) is optimized for apps that require
28
- sub-second response times. ModusDB augments polyglot functions with simple to use data and vector
31
+ sub-second response times. ModusGraph augments polyglot functions with simple to use data and vector
29
32
storage. When paired together, you can build a complete AI semantic search or retrieval-augmented
30
33
generation (RAG) feature with a single framework.
31
34
@@ -35,49 +38,63 @@ generation (RAG) feature with a single framework.
35
38
package main
36
39
37
40
import (
38
- " github.com/hypermodeinc/modusdb"
41
+ " context"
42
+ " fmt"
43
+ " time"
44
+
45
+ mg " github.com/hypermodeinc/modusgraph"
39
46
)
40
47
41
- type User struct {
42
- Gid uint64 ` json:"gid,omitempty"`
43
- Id string ` json:"id,omitempty" db:"constraint=unique"`
44
- Name string ` json:"name,omitempty"`
45
- Age int ` json:"age,omitempty"`
48
+ type TestEntity struct {
49
+ Name string ` json:"name,omitempty" dgraph:"index=exact"`
50
+ Description string ` json:"description,omitempty" dgraph:"index=term"`
51
+ CreatedAt time.Time ` json:"createdAt,omitempty"`
52
+
53
+ // UID is a required field for nodes
54
+ UID string ` json:"uid,omitempty"`
55
+ // DType is a required field for nodes, will get populated with the struct name
56
+ DType []string ` json:"dgraph.type,omitempty"`
46
57
}
47
58
48
59
func main () {
49
- engine , err := modusdb.NewEngine (modusdb.NewDefaultConfig (" /local/modusdb" ))
50
- if err != nil {
51
- panic (err)
52
- }
53
- defer engine.Close ()
54
-
55
- gid , user , err := modusdb.Upsert (ns, User{
56
- Id: " 123" ,
57
- Name: " A" ,
58
- Age: 10 ,
59
- })
60
- if err != nil {
61
- panic (err)
62
- }
63
- fmt.Println (user)
64
-
65
- _ , queriedUser , err := modusdb.Get [User](ns, gid)
66
- if err != nil {
67
- panic (err)
68
- }
69
- fmt.Println (queriedUser)
70
-
71
- _, _, err = modusdb.Delete [User](ns, gid)
72
- if err != nil {
73
- panic (err)
74
- }
60
+ // Use a file URI to connect to a in-process modusGraph instance, ensure that the directory exists
61
+ uri := " file:///tmp/modusgraph"
62
+ // Assigning a Dgraph URI will connect to a remote Dgraph server
63
+ // uri := "dgraph://localhost:9080"
64
+
65
+ client , err := mg.NewClient (uri, mg.WithAutoSchema (true ))
66
+ if err != nil {
67
+ panic (err)
68
+ }
69
+ defer client.Close ()
70
+
71
+ entity := TestEntity{
72
+ Name: " Test Entity" ,
73
+ Description: " This is a test entity" ,
74
+ CreatedAt: time.Now (),
75
+ }
76
+
77
+ ctx := context.Background ()
78
+ err = client.Insert (ctx, &entity)
79
+
80
+ if err != nil {
81
+ panic (err)
82
+ }
83
+ fmt.Println (" Insert successful, entity UID:" , entity.UID )
84
+
85
+ // Query the entity
86
+ var result TestEntity
87
+ err = client.Get (ctx, &result, entity.UID )
88
+ if err != nil {
89
+ panic (err)
90
+ }
91
+ fmt.Println (" Query successful, entity:" , result.UID )
75
92
}
76
93
```
77
94
78
95
## Open Source
79
96
80
- The modus framework, including modusDB , is developed by [ Hypermode] ( https://hypermode.com/ ) as an
97
+ The modus framework, including modusGraph , is developed by [ Hypermode] ( https://hypermode.com/ ) as an
81
98
open-source project, integral but independent from Hypermode.
82
99
83
100
We welcome external contributions. See the [ CONTRIBUTING.md] ( ./CONTRIBUTING.md ) file if you would
90
107
91
108
## Acknowledgements
92
109
93
- ModusDB builds heavily upon packages from the open source projects of
110
+ modusGraph builds heavily upon packages from the open source projects of
94
111
[ Dgraph] ( https://github.com/hypermodeinc/dgraph ) (graph query processing and transaction
95
112
management), [ Badger] ( https://github.com/dgraph-io/badger ) (data storage), and
96
- [ Ristretto] ( https://github.com/dgraph-io/ristretto ) (cache). We expect the architecture and
97
- implementations of modusDB and Dgraph to expand in differentiation over time as the projects
98
- optimize for different core use cases, while maintaining Dgraph Query Language (DQL) compatibility.
113
+ [ Ristretto] ( https://github.com/dgraph-io/ristretto ) (cache). modusGraph also relies on the
114
+ [ dgman] ( https://github.com/dolan-in/dgman ) repository for much of its functionality. We expect the
115
+ architecture and implementations of modusGraph and Dgraph to expand in differentiation over time as
116
+ the projects optimize for different core use cases, while maintaining Dgraph Query Language (DQL)
117
+ compatibility.
0 commit comments