Files
herolib/lib/vfs/vfs_contacts/model_fsentry.v
Mahmoud Emad abd694015b feat: Add contacts database and VFS implementation
- Added a new contacts database (`ContactsDB`) to store contact
  information.  This improves data organization and allows for
  more efficient querying and manipulation of contact data.
- Implemented a virtual file system (VFS) for contacts
  (`vfs_contacts`). This provides a file-like interface to access
  and manage contact data, improving integration with existing
  file-system-based tools and workflows.  The VFS supports
  listing by group, by name, and by email.
- Added model structs for contacts, improving data organization and
  serialization.  This lays the foundation for more robust data
  handling and future expansion.
2025-03-17 15:58:20 +02:00

36 lines
869 B
V

module vfs_contacts
import freeflowuniverse.herolib.vfs
import freeflowuniverse.herolib.circles.mcc.models as contacts
// ContactsFSEntry implements FSEntry for contacts objects
pub struct ContactsFSEntry {
pub mut:
path string
metadata vfs.Metadata
contact ?contacts.Contact
}
// is_dir returns true if the entry is a directory
pub fn (self &ContactsFSEntry) is_dir() bool {
return self.metadata.file_type == .directory
}
// is_file returns true if the entry is a file
pub fn (self &ContactsFSEntry) is_file() bool {
return self.metadata.file_type == .file
}
// is_symlink returns true if the entry is a symlink
pub fn (self &ContactsFSEntry) is_symlink() bool {
return self.metadata.file_type == .symlink
}
pub fn (e ContactsFSEntry) get_metadata() vfs.Metadata {
return e.metadata
}
pub fn (e ContactsFSEntry) get_path() string {
return e.path
}