Home > Class Reference > %SYS namespace > %ZHSLIB.PackageManager.Server.SemVerIndex

%ZHSLIB.PackageManager.Server.SemVerIndex

index class %ZHSLIB.PackageManager.Server.SemVerIndex extends %Library.FunctionalIndex

Functional index on semantic versions. This serves two purposes:

  1. Enable searching based on module name and semantic version expression without scanning the whole extent
  2. Simplify ordering based on latest semantic version, properly handling major/minor/patch version numbers and prerelease designations.

To use this index in a class, define an index on a string property (the module name) and a property of type %ZHSLIB.PackageManager.Core.SemanticVersion. Index SemVer On (Name, Version) As %ZHSLIB.PackageManager.Server.SemVerIndex; You must also define a property with the same name as that index, as follows: Property SemVer As %String(MAXLEN = 512) [ SqlComputeCode = {set {*} = ##class(%ZHSLIB.PackageManager.Server.Module).SemVerNode({Name},{Version})}, SqlComputed, SqlComputeOnChange = (%%INSERT, %%UPDATE) ];

For an example, see %ZHSLIB.PackageManager.Server.Module.

To use the generated Find method and the %ZHSLIB.PackageManager.Server.SemVerFind (as in the example of %ZHSLIB_PackageManager_Server._Module): SELECT Name,VersionString FROM %ZHSLIB_PackageManager_Server._Module WHERE ID %INSET %ZHSLIB_PackageManager_Server.Module_SemVerFind('HS.JSON','0.x','snapshot') To facilitate ordering by semantic version, classes that define such indices may also implement class queries to wrap %ZHSLIB.PackageManager.Server.SemVerFind:Matches.

Method Inventory

Methods

classmethod Delete(pGlobal, pID, pName, pVersion) [ Language = objectscript ]
classmethod DeleteIndex(pID As %Library.RawString, pArg... As %Binary) [ Language = objectscript ]
This method is invoked when an existing instance of a class is deleted.
classmethod Find(pName As %Binary, pVersionExpression As %String = "", pParameters As %String = "") as %Library.Binary [ Language = objectscript, SQLProc = ]
classmethod GetIndexGlobalNode(pGlobal, pName, pVersion) as %String [ Language = objectscript ]
classmethod IndexLocation() [ Language = objectscript ]
classmethod IndexLocationForCompile(pClassName As %String, pIndexName As %String) as %String [ Language = objectscript ]
classmethod Insert(pGlobal, pID, pName, pVersion) [ Language = objectscript ]
classmethod InsertIndex(pID As %Library.RawString, pArg... As %Binary) [ Language = objectscript ]
This method is invoked when a new instance of a class is inserted into the database.
classmethod Node(pName, pVersion) as %String [ Language = objectscript ]
classmethod PurgeIndex() [ Language = objectscript ]
classmethod SortBeginIndex() [ Language = objectscript ]
classmethod SortEndIndex(pCommit As %Library.Integer = 1) [ Language = objectscript ]
classmethod UpdateIndex(pID As %Library.RawString, pArg... As %Binary) [ Language = objectscript ]
This method is invoked when an existing instance of a class is updated.

Inherited Members

Inherited Methods