qna

package
v0.24.8 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: BSD-3-Clause Imports: 18 Imported by: 1

Documentation

Overview

Package qna provides an implementation of rt.Runtime. ( Its name derives from "questions and answers" - because its the thing that talks to the database. )

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// contains filtered or unexported fields
}

uses its own cache to preserve values across domain changes

func NewOptions

func NewOptions() Options

func (Options) IsOption added in v0.24.8

func (m Options) IsOption(opt meta.Options) (okay bool)

func (Options) Option

func (m Options) Option(opt meta.Options) (ret rt.Value, err error)

func (Options) OptionByName

func (m Options) OptionByName(name string) (ret rt.Value, err error)

return an existing option.

func (*Options) SetOption

func (m *Options) SetOption(opt meta.Options, v rt.Value) (err error)

func (*Options) SetOptionByName

func (m *Options) SetOptionByName(name string, v rt.Value) (err error)

change an existing option.

type Runner

type Runner struct {
	writer.Sink // target for game output
	// contains filtered or unexported fields
}

an implementation of rt.Runtime

func NewRuntime

func NewRuntime(q query.Query) *Runner

func NewRuntimeOptions

func NewRuntimeOptions(q query.Query, opt Options) *Runner

func (*Runner) ActivateDomain

func (run *Runner) ActivateDomain(domain string) (err error)

func (*Runner) Call

func (run *Runner) Call(name string, aff affine.Affinity, keys []string, vals []rt.Value) (ret rt.Value, err error)

note: this is mirrored/mimicked in package testpat note: in order to generate appropriate defaults ( ex. a record of the right type ) can return both a both meaningful value *and* an error

func (*Runner) DynamicData added in v0.24.7

func (run *Runner) DynamicData() *query.Cache

exposed for save-load fix? look at moving this into the query layer

func (*Runner) GetField

func (run *Runner) GetField(target, rawField string) (ret rt.Value, err error)

func (*Runner) GetKindByName

func (run *Runner) GetKindByName(rawName string) (ret *rt.Kind, err error)

func (*Runner) PluralOf

func (run *Runner) PluralOf(singular string) (ret string)

func (*Runner) PopScope

func (run *Runner) PopScope()

remove most recently pushed set of variables. ( implements rt.Runtime )

func (*Runner) PushScope

func (run *Runner) PushScope(top rt.Scope)

add the passed set of variables to the pool of current variables ( implements rt.Runtime )

func (*Runner) Random

func (run *Runner) Random(inclusiveMin, exclusiveMax int) int

func (*Runner) ReciprocalsOf

func (run *Runner) ReciprocalsOf(b, rel string) (ret rt.Value, err error)

func (*Runner) RelateTo

func (run *Runner) RelateTo(a, b, rel string) (err error)

doesnt reformat the names.

func (*Runner) RelativesOf

func (run *Runner) RelativesOf(a, rel string) (ret rt.Value, err error)

func (*Runner) SetField

func (run *Runner) SetField(target, rawField string, val rt.Value) (err error)

func (*Runner) SetNotifier

func (run *Runner) SetNotifier(n rt.Notifier) (prev rt.Notifier)

func (*Runner) SingularOf

func (run *Runner) SingularOf(plural string) (ret string)

type UserValue

type UserValue struct {
	rt.Value
}

indicates a value stored by the user as opposed to a default read from the db. ( so save knows what to save )

func (UserValue) MarshalText added in v0.24.7

func (u UserValue) MarshalText() ([]byte, error)

implements TextMarshaler

Directories

Path Synopsis
Package qdb asks specific questions of the play.db for the package qna runtime.
Package qdb asks specific questions of the play.db for the package qna runtime.
Package decode unpacks stored programs and values from byte slices
Package decode unpacks stored programs and values from byte slices
a non-sql data format for use by the qna runtime
a non-sql data format for use by the qna runtime

Jump to

Keyboard shortcuts

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