Data

This package contains a set of abstract, portable data types. Some examples are anytype, anyvalues, anyarrays, anymaps, and stringmaps. Many serializable classes are based on these data types. For example, the classes configmap, filtermaps and connection parameters, which extend stringvaluemap. The package also includes several classes for working with data (E.g. data paging, filtering, GUIDs).

Interfaces

ICloneable

Interface for data objects that are able to create their full binary copy.

IStringIdentifiable

Interface for data objects that can be uniquely identifed by a string id. The interface extends IIdentifiable to hardcode id type to string. It is a common pattern to use a string GUID as the id, generated by IdGenerator.


Types

AnyValue

Cross-language implementation of a dynamic object that can hold a value of any type. The stored value can be converted to different types using a variety of accessor methods.

AnyValueArray

Cross-language implementation of a dynamic object array that can hold values of any type. The stored values can be converted to different types using a variety of accessor methods.

AnyValueMap

Cross-language implementation of a dynamic object map (dictionary) that can hold values of any type. The stored values can be converted to different types using a variety of accessor methods.

DataPage

Data transfer object that is used to pass results of paginated queries. It contains items of the retrieved page and (optional) the total number of items. Most often this object type is used to send responses to paginated queries. Pagination parameters are defined by the PagingParams object. The skip parameter in the PagingParams indicates how many items to skip. The takes parameter sets the number of items to return in the page. And the optional total parameter tells to return the total number of items in the query.

FilterParams

Data transfer object used to pass filter parameters as simple key-value pairs.

IIdentifiable

The IIdentifiable[K any] interface is used to create data objects that can be uniquely idendified by an ID.

IdGenerator

Helper class used to generate unique object IDs. It supports two types of IDs: long and short. Long IDs are string GUIDs. They are globally unique and 32-character long. ShortIDs are just 9-digit random numbers. They are not guaranteed be unique.

MultiString

An object that contains string translations for multiple languages. Language keys use two-letter codes like: ‘en’, ‘sp’, ‘de’, ‘ru’, ‘fr’, ‘pr’. When a translation for specified language does not exist it defaults to English (‘en’). When English does not exist it falls back to the first defined language.

PagingParams

Data transfer object used to pass paging parameters for queries. The page is defined by two parameters:

  • the skip parameter defines number of items to skip.
  • the take parameter sets how many items to return in a page.
  • additionally, the optional total parameter tells to return total number of items in the query.

ProjectionParams

Defines projection parameters with a list of the fields to include into query results. The parameters support two formats: dot format and nested format. The dot format is the standard way to define included fields and subfields using dot object notation: “field1,field2.field21,field2.field22.field221”

SortField

Defines a field name and order used to sort query results.

SortParams

Defines a list of field names used to sort query results.

StringValueMap

Cross-language implementation of a map (dictionary) where all keys and values are strings. The stored values can be converted to different types using a variety of accessor methods. The string map is highly versatile. It can be converted into many formats, stored and sent over the wire.

TagsProcessor

Helper class to extract and process search tags from objects. The search tags can be kept individually or embedded as hash tags inside text like “This text has #hash_tag that can be used for search.”

TokenizedDataPage

Data transfer object that is used to pass the results of paginated queries. It contains items of a retrieved page and (optional) a total number of items . Most often, this object type is used to send responses to paginated queries.

TokenizedPagingParams

Data transfer object to pass tokenized paging parameters for queries. It can be used for complex paging scenarios, like paging across multiple databases where the previous state is encoded in a token. The token is usually retrieved from the previous response. The initial request shall go with token == nil