mongo

package
v0.0.0-...-4b21e95 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider implements the Provider interface for a MongoDB connection

func NewProvider

func NewProvider(logger zerolog.Logger) (*Provider, error)

NewProvider creates a new provider and loads values in from the environment

func (*Provider) Connect

func (p *Provider) Connect(ctx context.Context) error

Connect connects to the MongoDB server and creates any indices as necessary

func (*Provider) CreatePartial

func (p *Provider) CreatePartial(ctx context.Context, event types.Event) error

func (*Provider) Disconnect

func (p *Provider) Disconnect(ctx context.Context) error

Disconnect terminates the connection to the MongoDB server

func (*Provider) GetAllEvents

func (p *Provider) GetAllEvents(ctx context.Context) ([]*types.Event, error)

func (*Provider) GetEvent

func (p *Provider) GetEvent(ctx context.Context, id string) (*types.Event, error)

GetEvent given its ID

func (*Provider) GetSingle

func (p *Provider) GetSingle(ctx context.Context, eventID string) (*types.Event, error)

func (*Provider) PopulateEvent

func (p *Provider) PopulateEvent(ctx context.Context, event types.Event, userID string) error

Update updates an existing event Ignore the following fields: - creatorID - guildID - channelID - populated - voteOptions - userVotes - userAvailability - userLocations - userVotes

func (*Provider) PostVotes

func (p *Provider) PostVotes(ctx context.Context, userID string, votes types.UserVotes, eventID string) error

Update updates an existing event

func (*Provider) PutUserAvailabilityAndLocation

func (p *Provider) PutUserAvailabilityAndLocation(ctx context.Context, userID string,
	availability types.UserAvailability, location types.UserLocation, eventID string) error

func (*Provider) UpdateVoteOptions

func (p *Provider) UpdateVoteOptions(ctx context.Context, voteOptions types.VoteOption, eventID string) error

Jump to

Keyboard shortcuts

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