Documentation ¶
Index ¶
- func CreateSchemas() error
- type Connection
- func (config *Connection) CreateRoom(name, roomType string) (Room, error)
- func (config *Connection) CreateUser(fname, lname, userType, officeID, livingspaceID string) (UserSpaces, error)
- func (config *Connection) DeleteRoom(ID string) (string, error)
- func (config *Connection) DeleteUser(ID string) (string, error)
- func (config *Connection) DestroyData() error
- func (config *Connection) GetRoom(name, ID string) (Room, error)
- func (config *Connection) GetRooms() ([]Room, error)
- func (config *Connection) GetUser(fname, lname, ID string) (UserSpaces, error)
- func (config *Connection) GetUsers(officeID, livingSpaceID string) ([]User, error)
- func (config *Connection) UpdateRoom(name, ID string) (string, error)
- func (config *Connection) UpdateUser(fname, lname, ID, officeID, livingspaceID string) (string, error)
- type PgConfig
- type Room
- type User
- type UserSpaces
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSchemas ¶
func CreateSchemas() error
CreateSchemas delete old schemam before creating new ones
Types ¶
type Connection ¶
Connection defines the database connection that is needed to make a database transaction
func InitDB ¶
func InitDB(config PgConfig) *Connection
InitDB creates a database connection that is used to execute the various database transactions
func (*Connection) CreateRoom ¶
func (config *Connection) CreateRoom(name, roomType string) (Room, error)
CreateRoom makes a database operation to create a new room of the provided type
func (*Connection) CreateUser ¶
func (config *Connection) CreateUser(fname, lname, userType, officeID, livingspaceID string) (UserSpaces, error)
CreateUser create a new user with the provided details
func (*Connection) DeleteRoom ¶
func (config *Connection) DeleteRoom(ID string) (string, error)
DeleteRoom deletes a room given the its ID
func (*Connection) DeleteUser ¶
func (config *Connection) DeleteUser(ID string) (string, error)
DeleteUser deletes the user given their user ID
func (*Connection) DestroyData ¶
func (config *Connection) DestroyData() error
DestroyData recreates the database thus destroying all the data that existed previously
func (*Connection) GetRoom ¶
func (config *Connection) GetRoom(name, ID string) (Room, error)
GetRoom fetches the room details given its ID
func (*Connection) GetRooms ¶
func (config *Connection) GetRooms() ([]Room, error)
GetRooms fetches all rooms that are currently in existence
func (*Connection) GetUser ¶
func (config *Connection) GetUser(fname, lname, ID string) (UserSpaces, error)
GetUser fetches and returns a user associated with the given ID
func (*Connection) GetUsers ¶
func (config *Connection) GetUsers(officeID, livingSpaceID string) ([]User, error)
GetUsers fetches all the users currently in existence
func (*Connection) UpdateRoom ¶
func (config *Connection) UpdateRoom(name, ID string) (string, error)
UpdateRoom updates the name of a given room
func (*Connection) UpdateUser ¶
func (config *Connection) UpdateUser(fname, lname, ID, officeID, livingspaceID string) (string, error)
UpdateUser updates the firstName and the last name to the user whose ID is provided
type PgConfig ¶
PgConfig defines the configuration needed to connect to a postgres database instance
type UserSpaces ¶
UserSpaces defines details of the occupants of the room in amity space allocation system