guide

package
v0.1.108 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package guide is the guide's example in miniature, for the front ends' tests: a vocabulary of packages and their imports, and the questions both front ends' TestEval ask of it, so the two languages are scored on the same cases. Only tests import it, and it imports no front end, so the front ends can be modules of their own without the root depending on one.

Index

Constants

This section is empty.

Variables

View Source
var Cases = []Case{
	{Name: "direct", Question: "what does app import directly?", Want: [][]string{{"api"}}},
	{Name: "transitive", Question: "what does app depend on, directly or not?", Want: [][]string{{"api"}, {"log"}, {"util"}}},
	{Name: "license", Question: "what license does util have?", Want: [][]string{{"Apache-2.0"}}},
	{Name: "unstated", Question: "which packages have no license stated?", Want: [][]string{{"api"}}},
	{Name: "count", Question: "how many packages does app depend on?", Want: [][]string{{"3"}}},
	{Name: "reverse", Question: "what imports util?", Want: [][]string{{"log"}}},
	{Name: "columns", Question: "list every package with its license", Want: [][]string{{"app", "MIT"}, {"api", "absent"}, {"log", ""}, {"util", "Apache-2.0"}}},
	{Name: "missing", Question: "who maintains api?", Want: [][]string{{"someone"}}},
}

Cases are questions as the guide asks them, with the rows a right program answers.

View Source
var CypherDrafts = map[string][]string{
	"what does app import directly?":            {`MATCH (:Package {name: 'app'})-[:IMPORTS]->(d) RETURN d.name`},
	"what does app depend on, directly or not?": {`MATCH (:Pakage {name: 'app'})-[:IMPORTS*]->(d) RETURN DISTINCT d.name`, `MATCH (:Package {name: 'app'})-[:IMPORTS*]->(d) RETURN DISTINCT d.name`},
	"what license does util have?":              {`MATCH (p:Package {name: 'util'}) RETURN p.license`},
	"which packages have no license stated?":    {`MATCH (p:Package) WHERE p.license IS NULL RETURN p.name`},
	"how many packages does app depend on?":     {`MATCH (:Package {name: 'app'})-[:IMPORTS*]->(d) RETURN count(DISTINCT d)`},
	"what imports util?":                        {`MATCH (x:Package)-[:IMPORTS]->(:Package {name: 'util'}) RETURN x.name`},
	"list every package with its license":       {`MATCH (p:Package) RETURN p.name, p.license`},
	"who maintains api?":                        {`MATCH (p:Package {name: 'api'}) RETURN p.maintainer`, `MATCH (p:Package {name: 'api'}) RETURN p.maintainer`},
}

CypherDrafts are the Cypher a scripted model writes for the guide's questions (guide.Cases), the ones the drafting arm's TestEval asks in jaala's syntax (nlmodels/translator), in the order it writes them: a right query for each, after a misspelled label for "transitive", which the refusal's did-you-mean fixes, and for "missing", the property the graph doesn't have, which Compile refuses and the model writes again.

Functions

func Code added in v0.1.98

func Code(t *testing.T) *datalog.Base

Code is a small graph laid out as Declaire lays out its own: node(id, kind), attr(id, key, value), and an edge relation per kind. goapp's Auth contains a callsite whose callee is oneauth's Get, and calls holds no edge across the two repos, as Declaire's doesn't. TestParse reaches oneauth's Parse through a helper, two calls away. Its shape for nl.Paths is node for kinds, calls and contains for edges, and attr's callee for a ref (#514 piece 5).

func Deps

func Deps(t testing.TB) (*ns.Vocabulary, *datalog.Base)

Deps is app importing api, api importing log, log importing util, four packages' licenses (api's absent, log's empty), and the deps module reaching through imports.

func Source added in v0.1.80

func Source() *ns.MemSource

Source is Deps' facts.

func Vocabulary added in v0.1.80

func Vocabulary(t testing.TB, src ns.Source) *ns.Vocabulary

Vocabulary is Deps' vocabulary over src, which serves Source's relations: stdlib and the deps module, so a store holding the same facts answers the guide's questions too.

Types

type Case

type Case struct {
	Name, Question string
	Want           [][]string
}

A Case is a question and the rows a right program answers, as nl.Case holds them.

Jump to

Keyboard shortcuts

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