Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFailure = fmt.Errorf("trealla: query failed")
ErrFailure is returned when a query fails (when it finds no solutions).
Functions ¶
This section is empty.
Types ¶
type Answer ¶
type Answer struct { // Query is the original query goal. Query string // Answers are the solutions (substitutions) for a successful query. Answers []Solution // Output is captured stdout text from this query. Output string }
Answer is a query result.
type Compound ¶
type Compound struct { // Functor is the principal functor of the compound. // Example: the Functor of foo(bar) is "foo". Functor string // Args are the arguments of the compound. Args []Term }
Compound is a Prolog compound type.
type ErrThrow ¶
type ErrThrow struct { // Ball is the term thrown by throw/1. Ball Term }
ErrThrow is returned when an exception is thrown during a query.
type Option ¶
type Option func(*prolog)
Option is an optional parameter for New.
func WithMapDir ¶
WithMapDir sets alias to point to directory dir, granting access to it. This can be called multiple times with different aliases.
func WithPreopenDir ¶
WithPreopenDir sets the preopen directory to dir, granting access to it. Calling this again will overwrite it. More or less equivalent to `WithMapDir(dir, dir)`.
type Prolog ¶
type Prolog interface { // Query executes a query. Query(ctx context.Context, query string) (Answer, error) }
Prolog is a Prolog interpreter.
type Solution ¶
Solution is a mapping of variable names to substitutions. In other words, it's one answer to a query.
func (*Solution) UnmarshalJSON ¶
UnmarshalJSON implements the encoding/json.Marshaler interface.