finch_model_less library

Classes

CollectionEvent
Event management system for database collection operations. This class provides event handling capabilities for database operations, allowing you to register listeners that are called when documents are inserted, updated, or deleted from a collection. Each event type supports both synchronous and asynchronous listeners, making it flexible for various use cases such as:
DBCollectionFree
An abstract class representing a MongoDB collection with utility methods. The DBCollectionFree 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, form validation, and generating REST API routes. This class is meant to be extended by other classes for more specific collection implementations. Features include:
DBFieldFree<T>
DBFormFree
DBIndex
Configuration class for MongoDB database indexes. This class encapsulates all the configuration options needed to create a MongoDB index. It provides a convenient way to define index properties that will be used when creating indexes on collection fields. MongoDB indexes improve query performance and can enforce constraints like uniqueness. This class supports all major index options including:
Event<T>
Generic event system for handling typed events with multiple listeners. This class provides a flexible event system that supports both synchronous and asynchronous listeners. Events can be emitted with typed data, and all registered listeners will be called in the order they were added. Features:
FieldResultFree<T>
FormResultFree
LMap
A class that provides a map with a default value for missing keys. This class wraps a standard Map and provides an operator to access map values. If a key is not found in the map, it returns a default value. If the default value is a String, it can include a placeholder @key that will be replaced with the missing key. Example usage:
MLess
A class that wraps around ModelLess and provides additional functionality or abstraction. This class is designed to manage and interact with an instance of ModelLess. It initializes with a ModelLess object or creates a default instance from an empty JSON string if none is provided.
ModelLess
The ModelLess class is a dynamic, flexible data structure designed to handle nested data structures and perform common operations such as accessing, setting, and manipulating data within the structure. This class is particularly useful in scenarios where you need to work with JSON-like data structures that may contain nested maps or lists. Below is a detailed breakdown of the key features and methods in the ModelLess class.
ModelLessArray<T>
The ModelLessArray class is a generic class that provides a structure for managing a collection of items, specifically designed to work with ModelLess objects. This class offers features such as accessing items by index, dynamically setting and getting values, parsing JSON into the array, and retrieving nested data using paths. Below is an explanation and breakdown of the key features:
MongoErrorResponse
Utility class for parsing and processing MongoDB error responses. This class provides static methods to analyze MongoDB operation errors and convert them into a more accessible format. It's particularly useful for handling write errors that occur during insert, update, or delete operations. The class can extract field-specific errors from MongoDB's error response format, making it easier to provide meaningful error messages to users and identify which fields caused validation or constraint violations. Example:
ObjectDescovery

Extensions

FormatHelper on dynamic
A set of extension methods for dynamic types to facilitate type conversion and provide default values when conversion is not possible. These methods help in safely converting dynamic values to specific types such as int, double, String, bool, List, ObjectId, and DateTime. Each method allows specifying a default value to return if the conversion fails. Example usage:
MapFormatHelper on Map
Extension on Map that provides utility methods for type conversion and data extraction. This extension adds methods to safely extract and convert values from a map with default values if the key is not found or if the value cannot be converted.
MapPath on Map<String, dynamic>
Extension on Map<String, dynamic> that allows navigating nested structures using a path string.

Typedefs

EventAsyncFunction<R> = Future<void> Function(R data)
Type definition for asynchronous event listener functions. These functions can perform async operations and are awaited during event emission, which means they can delay the completion of the database operation that triggered the event.
EventFunction<R> = void Function(R data)
Type definition for synchronous event listener functions. These functions are called immediately when an event is emitted and should complete quickly to avoid blocking the event emission process.