database

package
v0.0.0-...-7ee3c9b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GetUserByIdQuery       = "SELECT * FROM users_table WHERE id =$1"
	GetUserByUsernameQuery = "SELECT * FROM users_table WHERE username =$1"
	GetUserByEmailQuery    = "SELECT * FROM users_table WHERE email =$1"
)

Functions

This section is empty.

Types

type DBHandler

type DBHandler interface {
	// Create
	CreateUser(user baseuser.User) error
	CreateTeam(founder baseuser.User, team baseteam.Team) error
	CreateGroup(owner baseuser.User, group group.Group) error

	// GET
	GetUserById(id string) (model.Team, error)
	GetUserByEmail(email string) (model.Team, error)
	GetUserByUsername(username string) (model.Team, error)
	GetPassword(id string) (string, error)
	GetAllUsers() ([]model.User, error)
	GetAllUsersFromSearchQuery(search map[string]interface{}) ([]model.User, error)
	GetUserBasedOnParam(param string, query string) (model.User, error)

	GetTeamByID(id string) (model.Team, error)
	GetTeamByName(name string) (model.Team, error)
	GetTeamsByType(teamType string) ([]model.Team, error)
	GetTeamsByIndustry(industry string) ([]model.Team, error)
	GetAllTeams() ([]model.Team, error)
	GetAllTeamsFromSearchQuery(search map[string]interface{}) ([]model.Team, error)
	GetTeamBasedOnParam(param string, query string) (model.Team, error)

	GetGroupBasedOnParam(param string, query string) (model.Group, error)
	GetGroupById(id string) (model.Group, error)
	GetGroupByName(name string) (model.Group, error)

	// Update
	UpdateUser(param map[string]interface{}, id string) (model.Team, error)

	UpdateTeamName(name string, teamId string) (model.Team, error)
	UpdateTeamType(teamType string, teamId string) (model.Team, error)
	UpdateTeamOverview(overView string, teamId string) (model.Team, error)

	AddTeamMemberToTeam(teamMember model.TeamMember, teamId string) (model.Team, error)
	RemoveTeamMemberFromTeam(teamMember model.TeamMember, teamId string) (model.Team, error)
	AddAdvisorToTeam(advisorMember model.TeamMember, teamId string) (model.Team, error)
	RemoveAdvisorFromTeam(advisorMember model.TeamMember, teamId string) (model.Team, error)
	AddFounderToTeam(advisorMember model.TeamMember, teamId string) (model.Team, error)
	RemoveFounderFromTeam(advisorMember model.TeamMember, teamId string) (model.Team, error)

	AddMemberToGroup(memberId string, groupId string) (model.Team, error)
	RemoveMemberFromGroup(memberId string, groupId string) (model.Team, error)

	// Delete
	DeleteUserById(id string) (bool, error)
	DeleteUserByUsername(id string) (bool, error)
	DeleteUserByEmail(id string) (bool, error)
	DeleteUserBasedOnParam(param string, query string) (bool, error)

	DeleteTeamById(teamId string) (bool, error)
	DeleteTeamByName(teamName string) (bool, error)
	DeleteTeamTeamByEmail(teamEmail string) (bool, error)
	DeleteTeamBasedOnParam(param string, query string) (bool, error)

	DeleteGroupById(teamId string) (bool, error)

	// Existence
	DoesUserExist(searchParam string, query string) (bool, error)
	DoesTeamExist(searchParam string, query string) (bool, error)
	// contains filtered or unexported methods
}

type Database

type Database struct {
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(db *gorm.DB) *Database

func (Database) AddAdvisorToTeam

func (db Database) AddAdvisorToTeam(advisorMember model.TeamMember, teamId string) (model.Team, error)

func (Database) AddFounderToTeam

func (db Database) AddFounderToTeam(founderMember model.TeamMember, teamId string) (model.Team, error)

func (Database) AddMemberToGroup

func (db Database) AddMemberToGroup(memberId string, groupId string) (model.Group, error)

func (Database) AddTeamMemberToTeam

func (db Database) AddTeamMemberToTeam(teamMember model.TeamMember, teamId string) (model.Team, error)

func (Database) CreateGroup

func (db Database) CreateGroup(owner model.User, group model.Group) error

func (Database) CreateTeam

func (db Database) CreateTeam(founder model.User, team model.Team) error

func (Database) CreateUser

func (db Database) CreateUser(user model.User) error

func (Database) DeleteGroupById

func (db Database) DeleteGroupById(groupId string) (bool, error)

func (Database) DeleteTeamBasedOnParam

func (db Database) DeleteTeamBasedOnParam(param string, query string) (bool, error)

func (Database) DeleteTeamById

func (db Database) DeleteTeamById(teamId string) (bool, error)

func (Database) DeleteTeamByName

func (db Database) DeleteTeamByName(teamName string) (bool, error)

func (Database) DeleteTeamTeamByEmail

func (db Database) DeleteTeamTeamByEmail(teamEmail string) (bool, error)

func (Database) DeleteUserBasedOnParam

func (db Database) DeleteUserBasedOnParam(param string, query string) (bool, error)

func (Database) DeleteUserByEmail

func (db Database) DeleteUserByEmail(id string) (bool, error)

func (Database) DeleteUserById

func (db Database) DeleteUserById(id string) (bool, error)

func (Database) DeleteUserByUsername

func (db Database) DeleteUserByUsername(id string) (bool, error)

func (Database) DoesTeamExist

func (db Database) DoesTeamExist(searchParam string, query string) (bool, error)

func (Database) DoesUserExist

func (db Database) DoesUserExist(searchParam string, query string) (bool, error)

func (Database) GetAllTeams

func (db Database) GetAllTeams() ([]model.Team, error)

func (Database) GetAllTeamsFromSearchQuery

func (db Database) GetAllTeamsFromSearchQuery(search map[string]interface{}) ([]model.Team, error)

func (Database) GetAllUsers

func (db Database) GetAllUsers() ([]model.User, error)

func (Database) GetAllUsersFromSearchQuery

func (db Database) GetAllUsersFromSearchQuery(query map[string]interface{}) ([]model.User, error)

func (Database) GetGroupBasedOnParam

func (db Database) GetGroupBasedOnParam(param string, query string) (model.Group, error)

func (Database) GetGroupById

func (db Database) GetGroupById(id string) (model.Group, error)

func (Database) GetGroupByName

func (db Database) GetGroupByName(name string) (model.Group, error)

func (Database) GetTeamBasedOnParam

func (db Database) GetTeamBasedOnParam(param string, query string) (model.Team, error)

func (Database) GetTeamByID

func (db Database) GetTeamByID(id string) (model.Team, error)

func (Database) GetTeamByName

func (db Database) GetTeamByName(name string) (model.Team, error)

func (Database) GetTeamsByIndustry

func (db Database) GetTeamsByIndustry(industry string) ([]model.Team, error)

func (Database) GetTeamsByType

func (db Database) GetTeamsByType(teamType string) (model.Team, error)

func (Database) GetUserBasedOnParam

func (db Database) GetUserBasedOnParam(param string, query string) (model.User, error)

func (Database) GetUserByEmail

func (db Database) GetUserByEmail(email string) (model.User, error)

func (Database) GetUserById

func (db Database) GetUserById(id string) (model.User, error)

func (Database) GetUserByUsername

func (db Database) GetUserByUsername(username string) (model.User, error)

func (Database) RemoveAdvisorFromTeam

func (db Database) RemoveAdvisorFromTeam(advisorMember model.TeamMember, teamId string) (model.Team, error)

func (Database) RemoveFounderFromTeam

func (db Database) RemoveFounderFromTeam(founderMember model.TeamMember, teamId string) (model.Team, error)

func (Database) RemoveMemberFromGroup

func (db Database) RemoveMemberFromGroup(memberId string, groupId string) (model.Group, error)

func (Database) RemoveTeamMemberFromTeam

func (db Database) RemoveTeamMemberFromTeam(teamMember model.TeamMember, teamId string) (model.Team, error)

func (Database) UpdateTeamIndustry

func (db Database) UpdateTeamIndustry(industry string, teamId string) (model.Team, error)

func (Database) UpdateTeamName

func (db Database) UpdateTeamName(name string, teamId string) (model.Team, error)

func (Database) UpdateTeamOverview

func (db Database) UpdateTeamOverview(overView string, teamId string) (model.Team, error)

func (Database) UpdateTeamType

func (db Database) UpdateTeamType(teamType string, teamId string) (model.Team, error)

func (Database) UpdateUser

func (db Database) UpdateUser(param map[string]interface{}, id string) (model.User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL