baserow_rs::mapper

Trait FieldMapper

Source
pub trait FieldMapper: Clone {
    // Required methods
    fn map_fields(&mut self, fields: Vec<TableField>);
    fn get_field_id(&self, name: &str) -> Option<u64>;
    fn get_field_name(&self, id: u64) -> Option<String>;
    fn get_fields(&self) -> Vec<TableField>;
}
Expand description

A trait for mapping between Baserow field IDs and their human-readable names

This trait provides functionality to map between numeric field IDs used by Baserow and their corresponding human-readable names. This is useful when working with the API where field IDs are required, but you want to reference fields by their names in your code.

Required Methods§

Source

fn map_fields(&mut self, fields: Vec<TableField>)

Maps a collection of table fields, building the internal mapping structures

§Arguments
  • fields - A vector of TableField structs containing field metadata
Source

fn get_field_id(&self, name: &str) -> Option<u64>

Gets the field ID corresponding to a field name

§Arguments
  • name - The human-readable field name
§Returns
  • Option<u64> - The field ID if found, None otherwise
Source

fn get_field_name(&self, id: u64) -> Option<String>

Gets the field name corresponding to a field ID

§Arguments
  • id - The numeric field ID
§Returns
  • Option<String> - The field name if found, None otherwise
Source

fn get_fields(&self) -> Vec<TableField>

Gets all mapped fields

§Returns
  • Vec<TableField> - A vector of all mapped table fields

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§