Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object:
this < that => <0
this == that => 0
this > that => >0
This method may also be accessed via the <
<=
<=>
>=
and >
shortcut operators. If not overridden the default
implementation compares the toStr
representations. Also see docLang.
Examples:
3.compare(8) => -1
8.compare(3) => 1
8.compare(8) => 0
3 <=> 8 => -1 // shortcut for 3.compare(8)
Compare this object to the specified for equality. This
method may be accessed via the == and != shortcut operators.
If not overridden the default implementation compares for
reference equality using the === operator. If this method
is overridden, then hash() must also be overridden such that
any two objects which return true for equals() must return
the same value for hash(). This method must accept null
and
return false.
Return a unique hashcode for this object. If a class overrides hash() then it must ensure if equals() returns true for any two objects then they have same hash code.
Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:
Return a string representation of this object.
Trap a dynamic call for handling. Dynamic calls are invoked with the -> shortcut operator:
a->x a.trap("x", null)
a->x() a.trap("x", null)
a->x = b a.trap("x", [b])
a->x(b) a.trap("x", [b])
a->x(b, c) a.trap("x", [b, c])
The default implementation provided by Obj attempts to use reflection. If name maps to a method, it is invoked with the specified arguments. If name maps to a field and args.size is zero, get the field. If name maps to a field and args.size is one, set the field and return args[0]. Otherwise throw UnknownSlotErr.
This method called whenever an it-block is applied to an
object. The default implementation calls the function with this
,
and then returns this
.
Static
aboutStatic
commitCommit one or more diffs to the folio database. The argument may be one of the following:
If one diff is passed, return the new record. If a list of diffs is passed return a list of new records.
This is a synchronous blocking call which will return the new record or records as the result.
Examples:
// add new record
newRec: commit(diff(null, {dis:"New Rec!"}, {add}))
// add someTag to some group of records
readAll(filter).toRecList.map(r => diff(r, {someTag})).commit
Static
contextGet the current context as a Dict with the following tags:
username
for current useruserRef
id for current userlocale
current localeSkySpark tags:
projName
if evaluating in context of a projectnodeId
local cluster node idruleRef
if evaluating in context of a rule engineruleTuning
if evaluating in context of rule engineStatic
diffConstruct a modification "diff" used by commit. The orig should be the instance which was read from the database, or it may be null only if the add flag is passed. Any tags to add/set/remove should be included in the changes dict.
The following flags are supported:
add
: indicates diff is adding new recordremove
: indicates diff is removing record (in general you
should add trash tag instead of removing)transient
: indicate that this diff should not be flushed to
persistent storage (it may or may not be persisted).force
: indicating that changes should be applied regardless
of other concurrent changes which may be been applied after
the orig version was read (use with caution!)Examples:
// create new record
diff(null, {dis:"New Rec", someMarker}, {add})
// create new record with explicit id like Diff.makeAdd
diff(null, {id:151bd3c5-6ce3cb21, dis:"New Rec"}, {add})
// set/add dis tag and remove oldTag
diff(orig, {dis:"New Dis", -oldTag})
// set/add val tag transiently
diff(orig, {val:123}, {transient})
Static
echoWrite x.toStr
to standard output followed by newline. If x
is null then print "null". If no argument is provided then
print an empty line.
Optional
x: JsObjStatic
isReturn hx::HxRuntime.isSteadyState
Static
isStatic
libStatic
libStatic
libReturn grid of enabled libs and their current status. Columns:
Static
makeStatic
passwordStore a password key/val pair into current project's
password store. The key is typically a Ref of the
associated record. If the val
is null, then the password
will be removed. See docHaxall::Folio#passwords.
passwordSet(@abc-123, "password")
passwordSet(@abc-123, null)
Static
podsReturn list of installed Fantom pods
Static
readRead from database the first record which matches filter. If no matches found throw UnknownRecErr or null based on checked flag. If there are multiple matches it is indeterminate which one is returned. See readAll for how filter works.
Examples:
read(site) // read any site rec
read(site and dis=="HQ") // read site rec with specific dis tag
read(chiller) // raise exception if no recs with chiller tag
read(chiller, false) // return null if no recs with chiller tag
Static
readReall all records from the database which match the filter. The filter must an expression which matches the filter structure. String values may parsed into a filter using parseFilter function.
Options:
limit
: max number of recs to returnsort
: sort by display nameExamples:
readAll(site) // read all site recs
readAll(equip and siteRef==@xyz) // read all equip in a given site
readAll(equip, {limit:10}) // read up to ten equips
readAll(equip, {sort}) // read all equip sorted by dis
Static
readReall all records which match filter as stream of Dict records. See docHaxall::Streams#readAllStream.
Static
readReturn the intersection of all tag names used by all the records matching the given filter. The results are returned as a grid with following columns:
name
: string name of the tagkind
: all the different value kinds separated by "|"count
: total number of recs with the tag Also see readAllTagVals
and gridColKinds.Examples:
// read statistics on all tags used by equip recs
readAllTagNames(equip)
Static
readReturn the range of all the values mapped to a given tag
name used by all the records matching the given filter. This
method is capped to 200 results. The results are returned
as a grid with a single val
column. Also see readAllTagNames.
Examples:
// read grid of all unique point unit tags
readAllTagVals(point, "unit")
Static
readRead a record from database by id
. If not found throw
UnknownRecErr or return null based on checked flag. In
Haxall all refs are relative, but in SkySpark refs may be
prefixed with something like "p:projName:r:". This function
will accept both relative and absolute refs.
Examples:
readById(@2b00f9dc-82690ed6) // relative ref literal
readById(@:demo:r:2b00f9dc-82690ed6) // project absolute literal
readById(id) // read using variable
readById(equip->siteRef) // read from ref tag
Optional
checked: booleanStatic
readGiven record id, read only the persistent tags from Folio. Also see readByIdTransientTags and readById.
Optional
checked: booleanStatic
readRead a list of record 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 database 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). Either relative or project
absolute refs may be used.
Examples:
// read two relative refs
readByIds([@2af6f9ce-6ddc5075, @2af6f9ce-2d56b43a])
// read two project absolute refs
readByIds([@p:demo:r:2af6f9ce-6ddc5075, @p:demo:r:2af6f9ce-2d56b43a])
// return null for a given id if it does not exist
readByIds([@2af6f9ce-6ddc5075, @2af6f9ce-2d56b43a], false)
Static
readRead a list of ids as a stream of Dict records. If checked if false, then records not found are skipped. See docHaxall::Streams#readByIdsStream.
Static
readGiven record id, read only the transient tags from Folio. Also see readByIdPersistentTags and readById.
Optional
checked: booleanStatic
readStatic
readStatic
servicesGrid of installed services. Format of the grid is subject to change.
Static
stripStrip any tags which cannot be persistently committed to
Folio. This includes special tags such as hisSize
and any
transient tags the record has defined. If val
is Dict, then
a single Dict is returned. Otherwise val
must be Dict[] or
Grid and Dict[] is returned. The mod
tag is stripped unless
the {mod}
option is specified. The id
tag is not stripped
for cases when adding records with swizzled ids; pass {-id}
in options to strip the id
tag also.
Examples:
// strip uncommittable tags and keep id
toCommit: rec.stripUncommittable
// strip uncommittable tags and the id tag
toCommit: rec.stripUncommittable({-id})
// strip uncommittable tags, but keep id and mod
toCommit: rec.stripUncommittable({mod})
Static
toStatic
toStatic
toStatic
toStatic
tzdbReturn the installed timezone database as Grid with following columns:
Static
unitdbReturn the installed unit database as Grid with following columns:
Static
watchStatic
watchClose an open watch by id. If the watch does not exist or has expired then this is a no op. Also see hx::HxWatch.close and docHaxall::Watches#axon.
Static
watchOpen a new watch on a grid of records. The dis
parameter is
used for the watch's debug display string. Update and
return the grid with a meta watchId
tag. Also see hx::HxWatchService.open
and docHaxall::Watches#axon.
Example:
readAll(myPoints).watchOpen("MyApp|Points")
Static
watchPoll an open watch and return all the records which have changed since the last poll. Raise exception if watchId doesn't exist or has expired. Also see hx::HxWatch.poll and docHaxall::Watches#axon.
Static
watchStatic
xetoReload all the Xeto libraries
Haxall core "hx" axon functions supported by all runtimes