-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathdb.go
46 lines (35 loc) · 1.29 KB
/
db.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2022 Democratized Data Foundation
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package client
import (
"context"
ds "github.com/ipfs/go-datastore"
blockstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/sourcenetwork/defradb/datastore"
)
type DB interface {
AddSchema(context.Context, string) error
CreateCollection(context.Context, CollectionDescription) (Collection, error)
GetCollectionByName(context.Context, string) (Collection, error)
GetCollectionBySchemaID(context.Context, string) (Collection, error)
GetAllCollections(ctx context.Context) ([]Collection, error)
Root() ds.Batching
Blockstore() blockstore.Blockstore
NewTxn(context.Context, bool) (datastore.Txn, error)
ExecQuery(context.Context, string) *QueryResult
ExecTransactionalQuery(ctx context.Context, query string, txn datastore.Txn) *QueryResult
Close(context.Context)
Events() Events
PrintDump(ctx context.Context) error
}
type QueryResult struct {
Errors []any `json:"errors,omitempty"`
Data any `json:"data"`
}