nitrite library
Nitrite is a lightweight, embedded, and self-contained NoSQL database. It provides an easy-to-use API to store and retrieve data. Nitrite stores data in the form of documents and supports indexing on fields within the documents to provide efficient search capabilities. Nitrite supports transactions, and provides a simple and efficient way to persist data.
Nitrite is designed to be embedded within the application and does not require any external setup or installation.
This library provides a Dart implementation of Nitrite.
Classes
-
AbstractNitriteStore<
Config extends StoreConfig> - An abstract implementation of the NitriteStore interface that provides common functionality for Nitrite data stores.
- Attributes
- Represents metadata attributes of a NitriteMap.
- BaseTextTokenizer
- An abstract text tokenizer which tokenizes a given string. It discards certain words known as stop word depending on the language chosen.
- BoundingBox
- Represents a bounding box for spatial indexing.
-
CollectionEventInfo<
T> - Represents a collection event data.
- CollectionInstruction
- Represents a migration instruction set for NitriteCollection.
- ComparableFilter
- An abstract class representing a filter that compares fields.
- Convertable
- Specifies nitrite code generators to generate the code for EntityConverter implementation of the marked class.
-
Cursor<
T> - An interface to iterate over ObjectRepository.find results.
- DatabaseInstruction
- Represents a migration instruction set for the nitrite database.
- Document
- Represents a document in Nitrite database.
- DocumentCursor
- The DocumentCursor represents a cursor as a stream of Document to iterate over NitriteCollection.find results. It also provides methods for projection and perform left outer joins with other DocumentCursors.
- DocumentKey
- Specifies nitrite code generators to consider the marked field/accessor as a document key while generating document mapping code.
- EnglishTextTokenizer
- A TextTokenizer implementation for the English languages.
- Entity
- Annotation to mark a class as an entity. An entity is a persistent class which can be stored in an ObjectRepository.
-
EntityConverter<
T> -
An abstract class that is used to convert an entity of type
T
into a database Document and vice versa. -
EntityDecorator<
T> -
An interface that can be used to implement a decorator
for an entity class of type
T
, where annotating the class with Entity or its friends is not possible. - EntityId
- Represents the unique identifier for an entity in an ObjectRepository.
- EntityIndex
- Represents an index for an entity in the Nitrite database.
- EventInfo
- Represents an event information object that contains the event type and Nitrite configuration.
- FieldBasedFilter
- The base class for all field-based filters in Nitrite. Provides common functionality for filters that operate on a specific field.
- Fields
- Represents a collection of document field names and provides methods for manipulating and comparing them.
- FieldValues
- Represents a collection of field-value pairs, with methods to retrieve values by field name.
- Filter
- An interface to specify filtering criteria during find operation. When a filter is applied to a collection, based on the criteria it returns a set of matching records.
- FindOptions
- The options for find operation.
- FindPlan
- A plan for finding documents in a collection.
- FluentFilter
- A fluent api for the NitriteFilter.
- Id
- Annotation to mark a field as the id field of a repository.
- IgnoredKey
- Specifies nitrite code generators to ignore the marked field/accessor while generating document mapping code.
- Index
- Annotation to mark a field as indexed.
- IndexDescriptor
- A class representing the descriptor of a Nitrite index.
- IndexOnlyFilter
- An abstract class representing a filter that can be applied to an index.
- IndexOptions
- Options for configuring an index.
- IndexType
- An interface representing the types of indexes supported by Nitrite.
- Instruction
- Represents a collection of database migration steps.
- InstructionSet
- Represents a set of instruction to perform during database migration.
- Language
- Represents a set of stop words for a specific language.
- LogicalFilter
- Represents a filter which does a logical operation (AND, OR) between a set of filters.
- LookUp
- Represents lookup parameters in join operation of two collections.
- Migration
-
Represents the database migration operation. A migration is a way to modify
the structure of a database from one version to another. It contains a queue
of
MigrationStep
s that need to be executed in order to migrate the database from the start version to the end version. - Nitrite
- Nitrite is a lightweight, embedded, and self-contained NoSQL database. It provides an easy-to-use API to store and retrieve data. Nitrite stores data in the form of documents and supports indexing on fields within the documents to provide efficient search capabilities. Nitrite supports transactions, and provides a simple and efficient way to persist data.
- NitriteBuilder
- The NitriteBuilder class provides a fluent API to configure and create a Nitrite database instance.
- NitriteCollection
- Represents a named document collection stored in Nitrite database. It persists documents into the database. Each document is associated with a unique NitriteId in a collection.
- NitriteConfig
- NitriteConfig is a configuration class for Nitrite database.
- NitriteFilter
- An abstract class representing a filter for Nitrite database.
- NitriteId
- A unique identifier across the Nitrite database. Each document in a collection is associated with a unique NitriteId.
- NitriteIndex
- The NitriteIndex interface represents an index in Nitrite database. It provides methods to write, remove and find NitriteIds from the index. It also provides methods to drop the index and validate the index field.
- NitriteIndexer
- An abstract class representing a Nitrite indexer plugin.
-
NitriteMap<
Key, Value> - Represents a Nitrite key-value pair map. Every piece of data in a Nitrite database is stored in NitriteMap.
- NitriteMapper
- An abstract class that provides a method to try converting an object of one type to another type.
- NitriteModule
- An abstract class that represents a module encapsulating a set of NitritePlugin objects.
- NitritePlugin
- An abstract class that represents a plugin for working with Nitrite database and provides methods for initializing and closing the plugin instance.
-
NitriteRTree<
Key, Value> - Represents an R-Tree in the nitrite database.
-
NitriteStore<
Config extends StoreConfig> - Represents a storage interface for Nitrite database.
-
ObjectRepository<
T> - Represents a type-safe persistent dart object collection. An object repository is backed by a NitriteCollection, where all objects are converted into a Document and saved into the database.
-
PersistentCollection<
T> - A persistent collection interface that provides methods to manage and manipulate data in a Nitrite database.
- Processor
- A class that provides methods to process a document before writing it into database or after reading from the database.
- RepositoryInstruction
- Represents a migration instruction set for ObjectRepository.
- Session
- A session represents a transactional context for a Nitrite database. It provides methods to create a new transaction.
- SimpleNitriteMapper
- A NitriteMapper based on EntityConverter implementation.
- SortableFields
- Represents a collection of fields that can be sorted, with each field having a specified sort order.
- SortingAwareFilter
- StoreConfig
- Represents the configuration interface of a NitriteStore.
- StoreModule
- Represents a nitrite store module to load as a storage engine for the database.
- StringFilter
- An abstract class representing a filter for string values.
- TextTokenizer
- An abstract class representing a stop-word based text tokenizer.
- Transaction
- Represents a transaction in Nitrite database. It provides methods to perform transactional operations on Nitrite database collections and repositories.
- UniversalTextTokenizer
- A TextTokenizer implementation that tokenizes text using a universal approach.
- UpdateOptions
- Represents options to configure update operation.
- WriteResult
- A class representing the result of a write operation in Nitrite database. It is an iterable of NitriteIds of affected Documents.
Enums
- EventType
- Represents different types of collection events.
- Languages
- An enum representing the supported languages for full-text search in Nitrite.
- SortOrder
- An enum is used to specify the sort order for sorting operations.
- StoreEvents
- An enumeration of events that can occur in a Nitrite store.
- TransactionState
- An enumeration representing the possible states of a transaction.
Extensions
- StringFilterExtension on FieldName
- String extension for nitrite filter.
Constants
- initialSchemaVersion → const int
- The initial schema version of Nitrite database.
Properties
- $ ↔ FluentFilter
-
The where clause for elemMatch filter.
getter/setter pair
- all → Filter
-
A filter to select all elements.
final
Functions
-
and(
List< Filter> filters) → Filter - Returns a filter that performs a logical AND operation on the provided filters. The returned filter accepts a document if all filters in the list accept the document.
-
byId(
NitriteId id) → Filter - Returns a filter that matches documents with the specified NitriteId.
-
createDocument(
String key, dynamic value) → Document -
Creates a Document from the given
key
andvalue
. -
distinct(
) → FindOptions - Creates a new instance of FindOptions with distinct flag set to true.
-
documentFromMap(
Map< String, dynamic> map) → Document -
Creates a Document from a
Map<String, dynamic>
. -
emptyDocument(
) → Document - Creates an empty Document.
-
indexOptions(
String indexType) → IndexOptions -
Creates an IndexOptions with the specified
indexType
. -
limitBy(
int limit) → FindOptions -
Creates a new instance of FindOptions with limit set to
limit
. -
module(
List< NitritePlugin> plugins) → NitriteModule - Creates a Nitrite module with a set of NitritePlugins.
-
or(
List< Filter> filters) → Filter - Returns a filter that performs a logical OR operation on the provided list of filters. The returned filter selects all documents that satisfy at least one of the filters in the list.
-
orderBy(
String fieldName, [SortOrder sortOrder = SortOrder.ascending]) → FindOptions -
Creates a new instance of FindOptions with sorting order set to
fieldName
andsortOrder
. -
skipBy(
int skip) → FindOptions -
Creates a new instance of FindOptions with skip set to
skip
. -
updateOptions(
{dynamic insertIfAbsent = false, dynamic justOnce = false}) → UpdateOptions -
Creates a new instance of UpdateOptions with
insertIfAbsent
andjustOnce
set to false. -
where(
String field) → FluentFilter - Creates a new FluentFilter instance with the specified field name.
Typedefs
-
CollectionEventListener<
T> = void Function(CollectionEventInfo< T> event) - A listener which is able to listen to any changes in a NitriteCollection or ObjectRepository.
-
CustomInstruction
= Future<
void> Function(Nitrite nitrite) - Represents a custom instruction for database migration.
- FieldName = String
- Generator = dynamic Function(Document document)
- Represents a default value generator for the document fields in field manipulation instruction.
- StoreEventListener = void Function(EventInfo eventInfo)
- A function type that defines the signature of a store event listener.
- TypeConverter = dynamic Function(dynamic value)
- Represents a type converter. It converts an object of a certain type to an object of another type.
Exceptions / Errors
- FilterException
- Exception thrown during find operations due to invalid filter expression.
- IndexingException
- Exception thrown when there is an error with indexing in Nitrite.
- InvalidIdException
- Exception thrown when an invalid ID is encountered.
- InvalidOperationException
- Exception thrown when an invalid operation is performed.
- MigrationException
- Exception thrown when there is an error during database migration.
- NitriteException
- Base class for all Nitrite exceptions.
- NitriteIOException
- Exception thrown when there is an IO error while performing an operation on Nitrite database.
- NitriteSecurityException
- Exception thrown when a security violation occurs in Nitrite.
- NotIdentifiableException
- Exception thrown when an object cannot be identified.
- ObjectMappingException
- Exception thrown when there is an error mapping an object to a document or vice versa.
- PluginException
- Exception thrown when a Nitrite plugin encounters an error.
- TransactionException
- Exception thrown when an error occurs during a transaction.
- UniqueConstraintException
- Exception thrown when a unique constraint is violated.
- ValidationException
- Exception thrown when a validation error occurs.