%SYS
SemVerIndex Class Reference
Inheritance diagram for SemVerIndex:
Collaboration diagram for SemVerIndex:

Static Public Member Functions

 DeleteIndex (_.Library.CacheString pID, _.Library.Binary pArg)
 This method is invoked when an existing instance of a class is deleted.
 
 InsertIndex (_.Library.CacheString pID, _.Library.Binary pArg)
 This method is invoked when a new instance of a class is inserted into the database.
 
 UpdateIndex (_.Library.CacheString pID, _.Library.Binary pArg)
 This method is invoked when an existing instance of a class is updated.
 

Detailed Description

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 <class>ZPM.PackageManager.Core.SemanticVersion</class>. Index SemVer On (Name, Version) As ZPM.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(ZPM.PackageManager.Server.Module).SemVerNode({Name},{Version})}, SqlComputed, SqlComputeOnChange = (%INSERT, %UPDATE) ];

For an example, see <class>ZPM.PackageManager.Server.Module</class>.

To use the generated Find method and the ZPM.PackageManager.Server.SemVerFind (as in the example of ZPM_PackageManager_Server._Module): SELECT Name,VersionString FROM ZPM_PackageManager_Server._Module WHERE ID INSET ZPM_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 ZPM.PackageManager.Server.SemVerFind:Matches.