外观
skyarcd
原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793488811/FIN+5.3.1+skyarcd 中文整理基于 FIN 5.3.1
导读: SkySpark 框架守护进程 API
以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。
目录(导读)
- mixins
- classes
- enums
- facets
- Slot Details
- actionTypeName
- aws
- dis
- envType
- extName
- fromStr
- isAws
- isLocal
- isTest
- local
- sysModTypeName
- test
- useLocalhostAddr
- vals
- actionNormInput
- add
- make
- remove
- toResult
- trash
- update
- validate
- asCur
- checkAdmin
- checkSu
- cur
- db
- ext
- exts
- feedKey
- filterPather
- ns
- proj
- read
- readAll
- readById
- rt
- session
- sys
- user
- hx
- settings
- depends
- icon
- name
- toStr
- meta
- vars
- type
- err
- errOn
- rec
- tag
- val
- warn
- warnOn
- lint
- create
- appendBin
- backup
- backups
- commit
- commitAll
- dir
- emptyTrash
- extActorPool
- extAdd
- extRemove
- id
- isSteadyState
- passwords
- pim
- readAllList
- readBin
- readByIds
- readByIdsList
- readCount
- watch
- watchOpen
- watches
- writeBin
- delete
- in
- size
- ts
- addExt
- addRec
- eval
- setup
- teardown
- placeholder
- restart
- homeDir
- host
- log
- mod
- mods
- varDir
- version
- authenticate
- users
- define
- execute
- findAll
- flatMap
- hisRead
- hisRollup
- hisRollupAuto
- makeContext
- map
- navProjs
- pivot
- projs
- timeout
- useReplicas
- …(其余标题见英文正文)
API 正文(英文)
enums
| CloudProviderType | Provider enum |
facets
| DbTest | Annotates a ProjTest method to setup a test project |
| ExtMeta | Meta-data facet which must be configured for each Ext type. |
| HxSysModMeta | Facet to apply to a HxSysMod subclass which wraps an HxLib from haxall |
| Setting | Facet to annotate a Settings field. |
CloudProviderType
@Serializable { simple=true } enum class CloudProviderType : Enum
Provider enum
Enum
| local | |
| aws | |
| test |
Constructors
| fromStr | Return the CloudProviderType instance for the specified name. |
Fields
| dis | Display name for the provider |
| envType | CloudEnv qualified type name |
| extName | Extension which implements clouddd::ProviderExt or null |
| vals | List of CloudProviderType values indexed by ordinal |
Methods
| actionTypeName | Qualified class name for DeployActions |
| isAws | |
| isLocal | |
| isTest | |
| sysModTypeName | Qualified class name for a provider-specific SysMod |
| useLocalhostAddr | Use 127.0.0.1 for all node addresses |
Slot Details
actionTypeName
Str actionTypeName(Str baseType)
Qualified class name for DeployActions
aws
const static CloudProviderType aws := ...
dis
const Str dis
Display name for the provider
envType
const Str envType
CloudEnv qualified type name
extName
const Str? extName
Extension which implements clouddd::ProviderExt or null
fromStr
static new fromStr(Str name, Bool checked := true)
Return the CloudProviderType instance for the specified name. If not a valid name and checked is false return null, otherwise throw ParseErr.
isAws
Bool isAws()
isLocal
Bool isLocal()
isTest
Bool isTest()
local
const static CloudProviderType local := ...
sysModTypeName
Str sysModTypeName(Str baseName)
Qualified class name for a provider-specific SysMod
test
const static CloudProviderType test := ...
useLocalhostAddr
Bool useLocalhostAddr()
Use 127.0.0.1 for all node addresses
vals
const static CloudProviderType[] vals := ...
List of CloudProviderType values indexed by ordinal
Committer
class Committer : Obj
Commit result of a form view or form action to Folio
Constructors
| make | Construct with form object which can be Grid or Dict |
Methods
| actionNormInput | Normalize an action argument passed to an Axon function. |
| add | Commit by adding the form as a new record in the database |
| remove | Commit by the removing the record(s) from the database |
| toResult | |
| trash | Commit by adding with the trash tag |
| update | Commit by updating the record(s) in the database |
| validate | Validate against the given template |
Slot Details
actionNormInput
static Obj actionNormInput(Obj arg, Str type)
Normalize an action argument passed to an Axon function. Actions should never assume a specific argument type, but instead should call this to convert to the desired type. The type should be one of the following string contants:
- "id": return selection as Ref
- "ids": return selection as Ref[]
- "dict": return form data as Dict
- "dicts": return form data as Dict[]
- "ioHandle": return a Uri as an IOHandle
- "ioHandles": return a Uri[] as IOHandle[]
Note that form "edits" only return changed values for dict input.
You may only obtain IO handles for files under the io/ directory.
Which conversions are available is based on the action itself. See Actions for more details.
add
Obj add()
Commit by adding the form as a new record in the database
make
new make(Obj arg)
Construct with form object which can be Grid or Dict
remove
Obj remove()
Commit by the removing the record(s) from the database
toResult
Obj? toResult()
trash
Obj trash()
Commit by adding with the trash tag
update
Obj update()
Commit by updating the record(s) in the database
validate
This validate(Str name)
Validate against the given template
Context
class Context : HxContext
Context manages the environment of Axon evaluations for a specific project and user
Constructors
| make | Make context for system and optional project |
Fields
| sys | System reference |
| user | User account and permissions associated with current context |
Methods
| asCur | Run function using this Context as the current one. |
| checkAdmin | If missing admin permission, throw PermissionErr |
| checkSu | If missing superuser permission, throw PermissionErr |
| cur | Current context for actor thread |
| db | Project database. |
| ext | Convenience for Proj.ext for current project. |
| exts | Convenience for Proj.exts for current project. |
| feedKey | |
| filterPather | Deprecated. |
| ns | Namespace of definitions in effect for this context |
| proj | Current project associated with context |
| read | Read a record by filter using cache. |
| readAll | Read a set of record by filter using cache. |
| readById | Read a record by id using cache. |
| rt | Project Haxall runtime. |
| session | Authentication session associated with this context if applicable |
Slot Details
asCur
Obj? asCur(|Context->Obj?| f)
Run function using this Context as the current one. This method automatically saves/restore the existing context.
checkAdmin
virtual override Void checkAdmin(Str action)
If missing admin permission, throw PermissionErr
checkSu
virtual override Void checkSu(Str action)
If missing superuser permission, throw PermissionErr
cur
static Context? cur(Bool checked := true)
Current context for actor thread
db
virtual override Folio db()
Project database. Raise exception if context not within a project.
ext
Ext? ext(Str name, Bool checked := true)
Convenience for Proj.ext for current project.
exts
Ext[] exts()
Convenience for Proj.exts for current project.
feedKey
Str feedKey()
filterPather
@Deprecated { msg="Use Filter.matches(rec, this)" } |Ref->Dict?| filterPather()
Deprecated. Now use Filter.matches with this as the context.
make
new make(Sys sys, User user, Proj? proj := null)
Make context for system and optional project
ns
virtual override SysNamespace ns()
Namespace of definitions in effect for this context
proj
Proj? proj(Bool checked := true)
Current project associated with context
read
Dict? read(Str filter, Bool checked := true)
Read a record by filter using cache.
readAll
Grid readAll(Str filter)
Read a set of record by filter using cache.
readById
Dict? readById(Ref id, Bool checked := true)
Read a record by id using cache.
rt
virtual override HxRuntime rt()
Project Haxall runtime.
session
virtual override Session? session(Bool checked := true)
Authentication session associated with this context if applicable
sys
const Sys sys
System reference
user
virtual const override User user
User account and permissions associated with current context
DbTest
@Serializable facet class DbTest : Obj, Facet
Annotates a ProjTest method to setup a test project
Slot Details
Ext
abstract const class Ext : HxLib
Ext is base class for extensions. To write an Ext:
- create concrete subclass of Ext
- annotate type with the
ExtMetafacet - create no arg make constructor (keep it lightweight)
- register with the "skyarc.ext" indexed prop
- define locale/en.props key "{name}.ext.dis"
- add ext to project using
Proj.extAdd
If the Ext implements the Weblet mixin, then it handles any requests under ApiMod "{api}/{proj}/ext/{name}". The modeBase and modRel URIs are configured to the top of the extension's URI space.
Also see docSkySpark.
Constructors
| make | All subclasses must declare an arg make. |
Methods
| hx | Get this ext as its native HxLib. |
| proj | Project this extension is running inside |
| settings | Ext settings - see Exts |
| sys | System reference |
Slot Details
hx
virtual HxLib hx()
Get this ext as its native HxLib. For normal SkySpark extensions we always return this instance. But for native HxLibs this Ext wraps the actual instance as an Ext.
make
new make()
All subclasses must declare an arg make.
proj
Proj proj()
Project this extension is running inside
settings
virtual Settings settings()
Ext settings - see Exts
sys
Sys sys()
System reference
ExtMeta
@Serializable facet class ExtMeta : Obj, Facet
Meta-data facet which must be configured for each Ext type.
Also see docSkySpark.
Fields
| depends | Str list of ext names this extension has a dependency on. |
| icon | Logical icon name |
| name | Programatic name of ext; must be a valid tag name and globally unique. |
Methods
| toStr | String representation is name |
Slot Details
depends
const Str[] depends := Str#.emptyList
Str list of ext names this extension has a dependency on.
icon
const Str icon := "puzzle"
Logical icon name
name
const Str name := ""
Programatic name of ext; must be a valid tag name and globally unique. Common pattern name of "FooExt" is "foo".
toStr
virtual override Str toStr()
String representation is name
HostMod
const class HostMod : SysMod
Host model and settings database
Fields
| meta | Host meta data tags |
Methods
| vars | Host variables |
Slot Details
meta
const Dict meta
Host meta data tags
vars
Dict vars()
Host variables
HxSysModMeta
@Serializable facet class HxSysModMeta : Obj, Facet
Facet to apply to a HxSysMod subclass which wraps an HxLib from haxall
Fields
| type | Type qname of the HxLib being wrapped |
Slot Details
type
const Str type
Type qname of the HxLib being wrapped
LintContext
mixin LintContext
Subject record and tag for a Linter
Methods
| err | Log linter error for the current subject |
| errOn | Add error on tag which isn't the subject tag |
| ns | Definition namespace |
| proj | Subject project |
| rec | Subject record |
| sys | System reference |
| tag | Subject tag definition |
| val | Subject tag value |
| warn | Log linter warning for the current subject |
| warnOn | Add warning on tag which isn't the subject tag |
Slot Details
err
abstract Void err(Str msg)
Log linter error for the current subject
errOn
abstract Void errOn(Str tag, Str msg)
Add error on tag which isn't the subject tag
ns
abstract SysNamespace ns()
Definition namespace
proj
abstract Proj? proj(Bool checked := true)
Subject project
rec
abstract Dict rec()
Subject record
sys
abstract Sys sys()
System reference
tag
abstract Def tag()
Subject tag definition
val
abstract Obj val()
Subject tag value
warn
abstract Void warn(Str msg)
Log linter warning for the current subject
warnOn
abstract Void warnOn(Str tag, Str msg)
Add warning on tag which isn't the subject tag
Linter
abstract const class Linter : Obj
Lint checker. To create a customer lint rule:
- Create subclass of Linter
- Ensure no arg constructor
- Override the
lintmethod - Register class name tag defs using
lintertag
Example code:
// def
def: ^myTag
is: ^str
doc: "Str cannot be empty or contain spaces"
linter: "myPod::LintMyTag"
// Fantom class
const class LintMyTag : Linter
{
override Void lint(LintContext cx)
{
str := cx.val as Str
if (str == null) return // already flagged as wrong type
if (str.isEmpty) cx.warn("String cannot be empty!")
if (str.contains(" ")) cx.warn("String cannot contain spaces!")
}
}Methods
| lint | Check the given subject rec and tag and report lint issues via LintContext.warn or LintContext.err. |
Slot Details
lint
abstract Void lint(LintContext cx)
Check the given subject rec and tag and report lint issues via LintContext.warn or LintContext.err.
LogMod
const class LogMod : SysMod
Logging engine
Methods
| create | Create or lookup a log identified by a set of tags which are either a Dict or Str:Obj. |
Slot Details
create
Log create(Obj tags)
Create or lookup a log identified by a set of tags which are either a Dict or Str:Obj. The follow tags are standardized:
name: required string name for logproj: project name if associated with a projectuser: username string if associated with a user actionconnRef: id of conn rec if associated specific connector
Proj
abstract const class Proj : Obj
Proj is the interface for working with a local in-VM project database.
Methods
| appendBin | |
| backup | Kick off a backup operation in the background. |
| backups | List the backups currently available for this Proj ordered by newest to oldest. |
| commit | Convenience for commitAll to commit a single diff. |
| commitAll | Apply a list of diffs to the database in batch. |
| dir | Base directory for project |
| dis | Display string for the project which is meta->dis or if not defined then the project name. |
| emptyTrash | Remove all the records which are marked with the trash flag. |
| ext | Find an installed extension by its programtic name. |
| extActorPool | The shared actor pool for extensions to use for their actors. |
| extAdd | Add an extension to the project |
| extRemove | Remove an extension from the project using one of the following: Ref id, ExtDef, Str name, or Ext instance. |
| exts | List the extensions which are enabled for this project. |
| id | Project id which is always formatted as "p:{name}" |
| isSteadyState | Has the proj has reached steady state. |
| meta | Return projMeta record |
| name | Project name |
| ns | Project specific definition namespace |
| passwords | Get storage for passwords and other secrets which is maintained separately from other data for security. |
| pim | Project specific presentation information model |
| read | Find the first record which matches the given filter string. |
| readAll | Match all the records against a filter string and return as grid. |
| readAllList | Match all the records against a filter string and return as list. |
| readBin | |
| readById | Convenience for readByIds |
| readByIds | Read a list of records by ids into a grid. |
| readByIdsList | Read a list of records by id. |
| readCount | Return the number of records which match the given filter string. |
| rt | Haxall runtime APIs |
| sys | System reference |
| toStr | Return name |
| watch | Find an open watch by its identifier. |
| watchOpen | Open a new watch with given display string for debugging. |
| watches | List the watches currently open for this project. |
| writeBin |
Slot Details
appendBin
@Deprecated { msg="Use virtual file system" } Void appendBin(Dict rec, Str tag, Buf data)
Append the specified bytes to the end of the bin. If tag doesn't map to a Bin value, then throw UnknownNameErr. The bytes are written according to OutStream.writeBuf. Once this method is called the buf should not be modified. This method blocks until the data is successfully appended. Throw IOErr on failure.
backup
abstract Future backup()
Kick off a backup operation in the background.
backups
abstract ProjBackup[] backups()
List the backups currently available for this Proj ordered by newest to oldest. Also see backup.
commit
Diff commit(Diff diff)
Convenience for commitAll to commit a single diff.
commitAll
Diff[] commitAll(Diff[] diffs)
Apply a list of diffs to the database in batch. Either all the changes are successfully applied, or else none of them are applied and an exception is raised. Return updated Diffs which encapsulate both the old and new version of each record.
If any of the records have been modified since they were read for the given change set then ConcurrentChangeErr is thrown unless Diff.force configured.
dir
abstract File dir()
Base directory for project
dis
Str dis()
Display string for the project which is meta->dis or if not defined then the project name.
emptyTrash
Void emptyTrash()
Remove all the records which are marked with the trash flag.
ext
abstract Ext? ext(Str name, Bool checked := true)
Find an installed extension by its programtic name. If not found then throw Err or return null based on checked flag.
extActorPool
abstract ActorPool extActorPool()
The shared actor pool for extensions to use for their actors.
extAdd
abstract Ext extAdd(ExtDef def, Dict tags := Etc.emptyDict())
Add an extension to the project
extRemove
abstract Void extRemove(Obj ext)
Remove an extension from the project using one of the following: Ref id, ExtDef, Str name, or Ext instance.
exts
abstract Ext[] exts()
List the extensions which are enabled for this project.
id
abstract Ref id()
Project id which is always formatted as "p:{name}"
isSteadyState
abstract Bool isSteadyState()
Has the proj has reached steady state. Steady state is reached after a configurable wait period elapses after the project is fully loaded. This gives internal services time to spin up before interacting with external systems. The default is 1min, but may be tuned via the steadyState tag on projMeta. See Tuning.
meta
abstract Dict meta()
Return projMeta record
name
abstract Str name()
Project name
ns
abstract SysNamespace ns()
Project specific definition namespace
passwords
PasswordStore passwords()
Get storage for passwords and other secrets which is maintained separately from other data for security.
pim
abstract PimEnv pim()
Project specific presentation information model
read
Dict? read(Str filter, Bool checked := true)
Find the first record which matches the given filter string. Throw UnknownRecErr or return null based on checked flag. See Filter Chapter for filter format.
readAll
Grid readAll(Str filter)
Match all the records against a filter string and return as grid. See Filter Chapter for filter format.
readAllList
Dict[] readAllList(Str filter)
Match all the records against a filter string and return as list. See Filter Chapter for filter format. See readAll to return results as a grid.
readBin
@Deprecated { msg="Use virtual file system" } InStream readBin(Dict rec, Str tag)
Open an input stream to read the bin contents of the specified rec. If tag doesn't map to a Bin value, then throw UnknownNameErr. If the bin content has never been successfully written throw IOErr. It is critical that the input stream be closed upon completion.
readById
Dict? readById(Ref? id, Bool checked := true)
Convenience for readByIds
readByIds
Grid readByIds(Ref[] ids, Bool checked := true)
Read a list of records by ids into a grid. The rows in the result correspond by index to the ids list. If checked is true, then every id must be found in the project or UnknownRecErr is thrown. If checked is false, then an unknown record is returned as a row with every column set to null (including the id tag).
readByIdsList
Dict?[] readByIdsList(Ref[] ids, Bool checked := true)
Read a list of records by id. The resulting list matches the list of ids by index (null if record not found).
readCount
Int readCount(Str filter)
Return the number of records which match the given filter string.
rt
abstract ProjHxRuntime rt()
Haxall runtime APIs
sys
abstract Sys sys()
System reference
toStr
override Str toStr()
Return name
watch
abstract Watch? watch(Str id, Bool checked := true)
Find an open watch by its identifier. If not found then throw Err or return null based on checked flag. Also see Watches.
watchOpen
abstract Watch watchOpen(Str dis)
Open a new watch with given display string for debugging. Also see Watches.
watches
abstract Watch[] watches()
List the watches currently open for this project. Also see Watches.
writeBin
@Deprecated { msg="Use virtual file system" } OutStream writeBin(Dict rec, Str tag, Int? size)
Open an output stream to write the bin of the specified rec. If tag doesn't map to a Bin value, then throw UnknownNameErr. If the size of the bin content is known, then it should be given for efficiency, otherwise pass null. It is critical that the output stream be closed upon completion.
ProjBackup
abstract const class ProjBackup : Obj
ProjBackup models a single backup file.
Methods
| delete | Delete the backup file which is an unrecoverable operation |
| in | Open an input stream to read the backup zip file |
| size | Size in bytes of the backup zip file |
| ts | Timestamp the backup was started |
Slot Details
delete
abstract Void delete()
Delete the backup file which is an unrecoverable operation
in
abstract InStream in()
Open an input stream to read the backup zip file
size
abstract Int size()
Size in bytes of the backup zip file
ts
abstract DateTime ts()
Timestamp the backup was started
ProjHxRuntime
const mixin ProjHxRuntime : HxRuntime
Project implementation of HxRuntime
Methods
| proj |
Slot Details
proj
abstract Proj proj()
ProjTest
abstract class ProjTest : HaystackTest
ProjTest is the base class for writing SkyArc tests which need access to a booted Sys. Tests annotated with DbTest are run with a fully booted project database:
@DbTest
Void testBasics()
{
x := addRec(["dis":"It works!"])
y := proj.readById(x.id)
verifyEq(y.dis, "It works!")
}Methods
| addExt | And an extension to proj and automatically add all the dependent extensions |
| addRec | Add a record to proj using the given map of tags. |
| commit | Convenience for commit to proj |
| eval | Evaluate an Axon expression using a super user context. |
| proj | Test project if @DbTest configured on test method |
| readById | Convenience for readById on proj |
| setup | If @DbTest configured then open proj |
| sys | Standard test Sys instance |
| teardown | If @DbTest configured then close down proj |
Slot Details
addExt
Ext addExt(Str extName, Str:Obj? tags := [Str:Obj?][:])
And an extension to proj and automatically add all the dependent extensions
addRec
virtual Dict addRec(Str:Obj? tags := [Str:Obj?][:])
Add a record to proj using the given map of tags.
commit
virtual Dict? commit(Dict rec, Obj? changes, Int flags := 0)
Convenience for commit to proj
eval
Obj? eval(Str axon)
Evaluate an Axon expression using a super user context.
proj
Proj? proj(Bool checked := true)
Test project if @DbTest configured on test method
readById
virtual Dict? readById(Ref id, Bool checked := true)
Convenience for readById on proj
setup
virtual override Void setup()
If @DbTest configured then open proj
sys
virtual Sys sys()
Standard test Sys instance
teardown
virtual override Void teardown()
If @DbTest configured then close down proj
Setting
@Serializable facet class Setting : Obj, Facet
Facet to annotate a Settings field.
Fields
| meta | Meta data for the def encoded as a Trio string. |
| placeholder | Text field place holder string |
| restart | Is restart required before a change takes effect |
Slot Details
meta
const Str meta := ""
Meta data for the def encoded as a Trio string. See the docs for ValDef meta for more details.
placeholder
const Str? placeholder
Text field place holder string
restart
const Bool restart
Is restart required before a change takes effect
Settings
const class Settings : Obj
Settings models the configuration of a system module or extension. It reflects Fantom fields to determine the different configuration settings, and then keeps them mapped them from the module/extension record. All subclasses must create an it-block constructor and annotate fields to configure with the Setting facet.
Slot Details
Sys
const class Sys : Obj
Sys is the top-level API to access SkyArc framework
Fields
| homeDir | Home dir where system is installed (parent for bin, lib, etc) |
| host | Host module |
| log | Log module |
| user | User module |
| varDir | Variable dir where database files, logs, etc are stored |
| version | System version |
Methods
| mod | Lookup system module |
| mods | System modules |
| rt | System HxRuntime |
Slot Details
homeDir
const File homeDir
Home dir where system is installed (parent for bin, lib, etc)
host
const HostMod host
Host module
log
const LogMod log
Log module
mod
SysMod? mod(Str name, Bool checked := true)
Lookup system module
mods
SysMod[] mods()
System modules
rt
SysHxRuntime rt()
System HxRuntime
user
const UserMod user
User module
varDir
const File varDir
Variable dir where database files, logs, etc are stored
version
const Version version
System version
SysHxRuntime
const mixin SysHxRuntime : HxRuntime
Sys implementation of HxRuntime
Slot Details
SysMod
abstract const class SysMod : HxLib
SysMod is a system module which plugs into the SkyArc framework
Methods
| settings | Module settings |
| sys | Sys reference |
Slot Details
settings
virtual Settings settings()
Module settings
sys
Sys sys()
Sys reference
UserMod
abstract const class UserMod : SysMod
UserMod manages the user database
Methods
| authenticate | Authenicate user for given web request. |
| user | Find a user account by Ref id or Str username. |
| users | List all configured users |
Slot Details
authenticate
abstract Session? authenticate(WebReq req, WebRes res, Dict? opts := null)
Authenicate user for given web request. If the request is for an unauthenticated user, then redirect to the login page and return null.
Options:
- attestCookies: enable cookie attestation
user
abstract User? user(Obj id, Bool checked := true)
Find a user account by Ref id or Str username. Return null or throw err if not found.
users
abstract User[] users()
List all configured users
Watch
abstract const class Watch : HxWatch
Watch is a subscription to a set of records in a project. It provides an efficient mechanism to poll for changes. Also see Watches.
Methods
| proj | Project associated with this watch |
Slot Details
proj
abstract Proj proj()
Project associated with this watch
XQuery
abstract class XQuery : Obj
XQuery is used to perform distributed queries across the cluster
Constructors
| makeContext | Construct for given context |
Methods
| define | Define a variable available to subsequent Axon expressions. |
| eval | Evaluate an Axon expression in each project |
| execute | Execute the query and return the results |
| findAll | Filter the previous Grid or Dict[] results with given expression. |
| flatMap | Apply the given Axon expression to the previous Grid or Dict[] results (typically a rec read operation) to map to zero or more new items. |
| hisRead | Read histories for the target recs using same semantics as hisRead. |
| hisRollup | Perform rollup on history data. |
| hisRollupAuto | Perform rollup on history data using semantics of hisRollupAuto. |
| map | Apply the given Axon expression to the previous Grid or Dict[] results (typically a rec read operation). |
| navProjs | Restrict to the currently configured navigation projects. |
| pivot | Transform the previous Grid or Dict[] results into a pivot table. |
| projs | Restrict query to given project name(s) |
| readAll | Convenience for readAllList which aggregates results to a Grid. |
| readAllList | Read records by filter. |
| readByIds | Convenience for readByIdsList which aggregates results to a Grid. |
| readByIdsList | Read recs by id. |
| sys | Sys reference |
| timeout | Set timeout to use for network calls to remote nodes. |
| useReplicas | Route this query to replicas if available instead of master nodes. |
| user | User context |
Slot Details
define
abstract This define(Str name, Obj? val)
Define a variable available to subsequent Axon expressions. This provides an easy way to marshall data across the cluster without encoding data to an Axon expression.
eval
abstract This eval(Str expr)
Evaluate an Axon expression in each project
execute
abstract XQueryResult execute()
Execute the query and return the results
findAll
abstract This findAll(Str expr)
Filter the previous Grid or Dict[] results with given expression. The expression must be a function with one parameter takes a Dict and returns a Bool (true to include, false to exclude).
flatMap
abstract This flatMap(Str expr)
Apply the given Axon expression to the previous Grid or Dict[] results (typically a rec read operation) to map to zero or more new items. The expression must be a function with one parameter which is the previous pipeline Dict to map and it must return a Dict[].
hisRead
abstract This hisRead(Obj? span, Obj? opts := null)
Read histories for the target recs using same semantics as hisRead. Note that null does not read the entire range for points, but rather defaults to system default span.
hisRollup
abstract This hisRollup(Obj fold, Obj interval)
Perform rollup on history data. The rollup function must be a named function available in all nodes. The rollup follows same semantics as hisRollup.
hisRollupAuto
abstract This hisRollupAuto(Obj? interval := null)
Perform rollup on history data using semantics of hisRollupAuto. Note that only an interval parameter is available in this version.
makeContext
static new makeContext(Context cx := Context.cur(), Dict? opts := null)
Construct for given context
map
abstract This map(Str expr)
Apply the given Axon expression to the previous Grid or Dict[] results (typically a rec read operation). The expression must be a function with one parameter which is the previous pipeline Dict to map and it must return the mapped Dict.
navProjs
abstract This navProjs()
Restrict to the currently configured navigation projects. Convenience for calling projs with navProjNames() Axon function.
pivot
abstract This pivot(Dict shape)
Transform the previous Grid or Dict[] results into a pivot table. Also see pivot() and Axon Usage
projs
abstract This projs(Obj names)
Restrict query to given project name(s)
readAll
abstract This readAll(Obj filter, Obj? opts := null)
Convenience for readAllList which aggregates results to a Grid.
readAllList
abstract This readAllList(Obj filter, Obj? opts := null)
Read records by filter.
readByIds
abstract This readByIds(Obj ids)
Convenience for readByIdsList which aggregates results to a Grid.
readByIdsList
abstract This readByIdsList(Obj ids)
Read recs by id. Results are not ordered the same as ids. Any ids not found or currently unavailable are silently ignored.
sys
abstract Sys sys()
Sys reference
timeout
abstract This timeout(Duration val)
Set timeout to use for network calls to remote nodes. Default uses queryTimeout value from settings
useReplicas
abstract This useReplicas(Bool val := true)
Route this query to replicas if available instead of master nodes. Default is false.
user
abstract User user()
User context
XQueryResult
abstract const class XQueryResult : Obj
Result of XQuery.execute
Methods
| dict | Get the result as one Dict. |
| dicts | Get results as a list of Dicts |
| grid | Get results as a grid |
| list | Get results as a list |
| val | Get the raw value |
Slot Details
dict
abstract Dict? dict(Bool checked := true)
Get the result as one Dict. If there is no results then raise UnknownRecErr or return null based on checked flag. If there are more than one result then return just one.
dicts
abstract Dict[] dicts()
Get results as a list of Dicts
grid
abstract Grid grid()
Get results as a grid
list
abstract Obj?[] list()
Get results as a list
val
abstract Obj? val()
Get the raw value