Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions api_dql.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package modusdb

import "fmt"

type QueryFunc func() string

const (
objQuery = `
{
obj(%s) {
uid
expand(_all_) {
uid
expand(_all_)
dgraph.type
}
dgraph.type
%s
}
}
`

funcUid = `func: uid(%d)`

Check failure on line 23 in api_dql.go

View workflow job for this annotation

GitHub Actions / ci-go-lint

const `funcUid` is unused (unused)

Check failure on line 23 in api_dql.go

View workflow job for this annotation

GitHub Actions / ci-go-lint

const `funcUid` is unused (unused)
funcEq = `func: eq(%s, %s)`

Check failure on line 24 in api_dql.go

View workflow job for this annotation

GitHub Actions / ci-go-lint

const `funcEq` is unused (unused)

Check failure on line 24 in api_dql.go

View workflow job for this annotation

GitHub Actions / ci-go-lint

const `funcEq` is unused (unused)
)

func buildUidQuery(gid uint64) QueryFunc {
return func() string {
return fmt.Sprintf("func: uid(%d)", gid)
}
}

func buildEqQuery(key, value any) QueryFunc {
return func() string {
return fmt.Sprintf("func: eq(%s, %s)", key, value)
}
}

func formatObjQuery(qf QueryFunc, extraFields string) string {
return fmt.Sprintf(objQuery, qf(), extraFields)
}
Loading
Loading