Documentation ¶
Overview ¶
Package database provides a client for interacting with the database.
Index ¶
- Constants
- func Close(ctx context.Context, m *Client) error
- type Client
- func (m *Client) AddUserToTeam(ctx context.Context, id string, userId string) error
- func (m *Client) BulkCreateResources(ctx context.Context, resources []*models.Resource) error
- func (m *Client) CreateResource(ctx context.Context, resource *models.Resource) error
- func (m *Client) CreateTeam(ctx context.Context, team *models.Team) error
- func (m *Client) CreateUser(ctx context.Context, user *models.User) error
- func (m *Client) DeleteOneResource(ctx context.Context, id string) error
- func (m *Client) DeleteTeam(ctx context.Context, id string) error
- func (m *Client) DeleteUser(ctx context.Context, id string) error
- func (m *Client) FindAllResourcesByTeamId(ctx context.Context, teamId string) ([]*models.Resource, error)
- func (m *Client) FindMultipleResources(ctx context.Context, teamId primitive.ObjectID, filters []models.Filter) ([]*models.Resource, error)
- func (m *Client) FindOneResource(ctx context.Context, id string) (*models.Resource, error)
- func (m *Client) FindTeam(ctx context.Context, id string) (*models.Team, error)
- func (m *Client) FindTeams(ctx context.Context) ([]*models.Team, error)
- func (m *Client) FindUser(ctx context.Context, id string) (*models.User, error)
- func (m *Client) FindUserByUsername(ctx context.Context, username string) (*models.User, error)
- func (m *Client) FindUsersByTeamId(ctx context.Context, teamId string) ([]*models.User, error)
- func (m *Client) UpdateOneResource(ctx context.Context, id string, resource *models.Resource) (*primitive.ObjectID, error)
- func (m *Client) UpdateTeam(ctx context.Context, id string, team *models.Team) (*primitive.ObjectID, error)
- func (m *Client) UpdateUser(ctx context.Context, id string, user *models.User) (*primitive.ObjectID, error)
Constants ¶
const ( // AeroSquirrelDatabase is the name of the database. AeroSquirrelDatabase = "aerosquirrel" // TeamCollection is the name of the team collection. TeamCollection = "teams" // UserCollection is the name of the user collection. UserCollection = "users" // ResourceCollection is the name of the resource collection. ResourceCollection = "resources" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for interacting with the database.
func (*Client) AddUserToTeam ¶
AddUserToTeam adds a user to a team in the database.
func (*Client) BulkCreateResources ¶
BulkCreateResources creates a resource in the database.
func (*Client) CreateResource ¶
CreateResource creates a resource in the database.
func (*Client) CreateTeam ¶
CreateTeam creates a new team in the database.
func (*Client) CreateUser ¶
CreateUser creates a new user in the database.
func (*Client) DeleteOneResource ¶
DeleteOneResource deletes a resource in the database.
func (*Client) DeleteTeam ¶
DeleteTeam deletes a team in the database.
func (*Client) DeleteUser ¶
DeleteUser deletes a user in the database.
func (*Client) FindAllResourcesByTeamId ¶
func (m *Client) FindAllResourcesByTeamId(ctx context.Context, teamId string) ([]*models.Resource, error)
FindAllResourcesByTeamId finds all resources in the database.
func (*Client) FindMultipleResources ¶
func (m *Client) FindMultipleResources(ctx context.Context, teamId primitive.ObjectID, filters []models.Filter) ([]*models.Resource, error)
FindMultipleResources finds multiple resources in the database.
func (*Client) FindOneResource ¶
FindOneResource finds a resource in the database.
func (*Client) FindUserByUsername ¶
FindUserByUsername finds a user in the database.
func (*Client) FindUsersByTeamId ¶
FindUsersByTeamId finds all users in the database.
func (*Client) UpdateOneResource ¶
func (m *Client) UpdateOneResource(ctx context.Context, id string, resource *models.Resource) (*primitive.ObjectID, error)
UpdateOneResource updates a resource in the database.