Documentation
¶
Overview ¶
Package database provides functionality for managing the connection and interactions with the Firestore database.
It includes initialization of the Firestore client and CRUD operations for all Firestore collections.
Index ¶
- Variables
- func ChangeCareGiver(newCg []models.Relationship, id string) error
- func CloseDB()
- func CreateCareGiver(c *gin.Context) error
- func CreateCareReceiver(data []byte) error
- func CreateSOSLog(data []byte) (string, error)
- func CreateTravelLog(data []byte) (string, error)
- func CreateVolunteer(c *gin.Context) error
- func DeleteCareGiver(id string) error
- func DeleteCareReceiver(id string) error
- func DeleteVolunteer(id string) error
- func FindSOSLog(SOSId string) (models.SOSLog, error)
- func InitCareGiver()
- func InitCareReceiver()
- func InitSosLog()
- func InitTravelLog()
- func InitVolunteers()
- func NewCareReceiver(newCareReceiver models.Relationship, id string) error
- func ReadAllCareGivers() ([]models.CareGiver, error)
- func ReadAllCareReceivers() ([]models.CareReceiver, error)
- func ReadAllSOSLogs() ([]models.SOSLog, error)
- func ReadAllTravelLogs() ([]models.TravelLog, error)
- func ReadAllVolunteers() ([]models.Volunteer, error)
- func ReadCareGiver(id string) (models.CareGiver, error)
- func ReadCareReceiver(id string) (models.CareReceiver, error)
- func ReadLatestSOSLog(id string) (models.SOSLog, error)
- func ReadLatestTravelLog(id string) (models.TravelLog, error)
- func ReadTravelLog(id string) ([]models.TravelLog, error)
- func ReadVolunteer(id string) (models.Volunteer, error)
- func RemoveCareReceiver(CgId string, CrId string) error
- func UpdateCareGiver(c *gin.Context, id string) error
- func UpdateCareReceiver(c *gin.Context, id string) error
- func UpdateSOSLog(data []byte, id string) error
- func UpdateTravelLog(data []byte, id string) error
- func UpdateVolunteer(c *gin.Context, id string) error
Constants ¶
This section is empty.
Variables ¶
var Client *firestore.Client
var FBCtx context.Context
Functions ¶
func ChangeCareGiver ¶
func ChangeCareGiver(newCg []models.Relationship, id string) error
ChangeCareGiver changes the care giver for a document with the matching id in the care_receiver Firebase collection
func CreateCareGiver ¶
CreateCareGiver creates a new document in the care_giver Firebase collection
func CreateCareReceiver ¶
CreateCareReceiver creates a document in the care_receiver Firebase collection
func CreateSOSLog ¶
CreateSOSLog creates a new document in the sos_log Firebase collection
func CreateTravelLog ¶
CreateTravelLog creates a new document in the travel_log Firebase collection
func CreateVolunteer ¶
CreateVolunteer creates a new document in the volunteers Firebase Collection
func DeleteCareGiver ¶
Delete the document with the matching id from the care_giver Firebase collection
func DeleteCareReceiver ¶
DeleteCareReceiver deletes a document with the matching id in the care_receiver Firebase collection
func DeleteVolunteer ¶
DeleteVolunteer deletes the document with matching id from the volunteer Firebase collection
func FindSOSLog ¶
FindSOSLog reads the document with the matching SOSId in the sos_log Firebase collection
func InitCareGiver ¶
func InitCareGiver()
InitCareGiver initialises the reference to the care_giver Firebase collection
func InitCareReceiver ¶
func InitCareReceiver()
InitCareReceiver initialises the reference to the care_receiver Firebase collection
func InitSosLog ¶
func InitSosLog()
InitSOSLog initialises the reference to the sos_log Firebase collection
func InitTravelLog ¶
func InitTravelLog()
InitTravelLog initialises the reference to the travel_log Firebase collection
func InitVolunteers ¶
func InitVolunteers()
InitVolunteers initialises the reference to the volunteers Firebase collection
func NewCareReceiver ¶
func NewCareReceiver(newCareReceiver models.Relationship, id string) error
NewCareReceiver adds a new care receiver to the care receiver list of the document with the matching id in the care_giver Firebase collection
func ReadAllCareGivers ¶
ReadAllCareGivers reads and returns all documents from the care_giver Firebase collection
func ReadAllCareReceivers ¶
func ReadAllCareReceivers() ([]models.CareReceiver, error)
ReadAllCareReceiver reads and returns all documents from the care_receiver Firebase collection
func ReadAllSOSLogs ¶
ReadAllSOSLogs reads and returns all documents from the sos_log Firebase collection
func ReadAllVolunteers ¶
ReadAllVolunteers reads and returns all documents from the volunteers Firebase collection
func ReadCareGiver ¶
ReadCareGiver reads and returns a document with the matching id from the care_giver Firebase collection
func ReadCareReceiver ¶
func ReadCareReceiver(id string) (models.CareReceiver, error)
ReadCareReceiver reads and returns the document with the mathcing id from the care_receiver Firebase collection
func ReadLatestSOSLog ¶
ReadLatestSOSLog reads and returns the all documents with cr_id field matching the specified id in the sos_log Firebase collection
func ReadLatestTravelLog ¶
ReadLatestTravelLog reads and returns the last created document with cr_id that matches the id, from the travel_log Firebase collection
func ReadTravelLog ¶
ReadTravelLog reads and returns all documents with cr_id matching the specified id in the travel_log Firebase collection
func ReadVolunteer ¶
ReadVolunteer reads and returns the document with matching id from the volunteers Firebase collection
func RemoveCareReceiver ¶
RemoveCareReceiver removes a new care receiver from the care receiver list of the document with the matching id in the care_giver Firebase collection
func UpdateCareGiver ¶
UpdateCareGiver updates a document with the matching id in the care_giver Firebase collection (use NewCareReceiver and RemoveCareReceiver to modify the care receiver list)
func UpdateCareReceiver ¶
UpdateCareReceiver updates the document with the matching id in the care_giver Firebase collection (use ChangeCareGiver to modify the related caregiver)
func UpdateSOSLog ¶
UpdateSOSLog updates the document with the matching id in the sos_log Firebase collection
func UpdateTravelLog ¶
UpdateTravelLog updates the document with matching id in the travel_log Firebase collection
Types ¶
This section is empty.