finch_model library

Classes

DateTimeConverter
A custom JsonConverter for serializing and deserializing DateTime objects. This converter handles the conversion of DateTime objects to and from JSON. It provides a default value of DateTime.parse('2000-01-01 00:00') when the JSON input is null. This ensures that a non-null DateTime object is always returned even if the input JSON is null. This converter can be used with the json_annotation package to facilitate JSON serialization and deserialization for Dart objects that include DateTime properties.
DBCollection
An abstract class representing a MongoDB collection with utility methods. The DBCollection class provides an abstraction over a MongoDB collection, offering various methods to interact with the database, such as checking for the existence of a document by its ID, updating fields, and more. This class is meant to be extended by other classes for more specific collection implementations.
DBModel
An abstract class that represents a database model with serialization capabilities. The DBModel class provides a blueprint for creating database models that can be converted into a map of parameters for MongoDB operations. It also provides a utility method to convert a list of such models into a list of maps, which can be useful for batch operations.
DQ
A utility class for building MongoDB queries. The DQ class provides a set of static methods to construct MongoDB-compatible queries in a more readable and structured way. It allows for easy creation of complex queries with operations such as equality checks, logical operations (\$or, \$and), pattern matching, and aggregation commands like grouping and sorting. Example Usage:
IDConverter
A custom JsonConverter for converting between ObjectId and String. This converter facilitates the serialization and deserialization of MongoDB's ObjectId objects to and from JSON strings. It provides a conversion between the ObjectId type used in MongoDB and the String type commonly used in JSON data. This converter is useful when working with MongoDB in Dart applications, particularly when using the json_annotation package for JSON serialization and deserialization.
MultiLanguage
A class that manages the loading and parsing of multi-language JSON files from a specified directory path. The MultiLanguage class provides functionality to load, read, and parse JSON files to create a map structure representing different language data. Example usage: