datastoredb

package
v0.0.0-...-a6df664 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Client *datastore.Client
}

DB implements master database.

func (*DB) Events

func (db *DB) Events(ctx context.Context) event.Repo

Events returns event.Repo.

func (*DB) Users

func (db *DB) Users(ctx context.Context) user.Repo

Users returns user.Repo.

type Events

type Events struct {
	Context context.Context
	Client  *datastore.Client
}

Events contains methods for managing events.

func (*Events) Ballots

func (repo *Events) Ballots(eventid event.EventID) ([]*event.Ballot, error)

Ballots retrieves all event ballots.

func (*Events) ByID

func (repo *Events) ByID(eventid event.EventID) (*event.Event, error)

ByID retrieves an event by ID.

func (*Events) Create

func (repo *Events) Create(ev *event.Event) error

Create creates a new event.

func (*Events) CreateIncompleteBallots

func (repo *Events) CreateIncompleteBallots(eventid event.EventID, userid user.UserID) (complete, incomplete []*event.BallotInfo, err error)

CreateIncompleteBallots creates new incomplete ballots for a user.

func (*Events) CreateTeam

func (repo *Events) CreateTeam(eventid event.EventID, team *event.Team) (event.TeamID, error)

CreateTeam creates a new team.

func (*Events) DeleteTeam

func (repo *Events) DeleteTeam(eventid event.EventID, teamid event.TeamID) error

DeleteTeam deletes a team.

func (*Events) List

func (repo *Events) List() ([]*event.Event, error)

List returns all events.

func (*Events) Results

func (repo *Events) Results(eventid event.EventID) ([]*event.TeamResult, error)

Results retrieves results for an event.

func (*Events) SubmitBallot

func (repo *Events) SubmitBallot(eventid event.EventID, ballot *event.Ballot) error

SubmitBallot submits a ballot.

func (*Events) TeamBallots

func (repo *Events) TeamBallots(eventid event.EventID, teamid event.TeamID) ([]*event.Ballot, error)

TeamBallots retrieves all event ballots for a team.

func (*Events) TeamByID

func (repo *Events) TeamByID(eventid event.EventID, teamid event.TeamID) (*event.Team, error)

TeamByID retrieves a team by ID.

func (*Events) Teams

func (repo *Events) Teams(eventid event.EventID) ([]*event.Team, error)

Teams returns all teams in an event.

func (*Events) TeamsByUser

func (repo *Events) TeamsByUser(userid user.UserID) ([]*event.EventTeam, error)

TeamsByUser returns all teams associated with the user.

func (*Events) Update

func (repo *Events) Update(ev *event.Event) error

Update updates an existing event.

func (*Events) UpdateTeam

func (repo *Events) UpdateTeam(eventid event.EventID, team *event.Team) error

UpdateTeam updates a team.

func (*Events) UserBallot

func (repo *Events) UserBallot(eventid event.EventID, userid user.UserID, teamid event.TeamID) (*event.Ballot, error)

UserBallot retrieves a user ballot.

func (*Events) UserBallots

func (repo *Events) UserBallots(eventid event.EventID, userid user.UserID) ([]*event.BallotInfo, error)

UserBallots retrieves all user ballots.

type Users

type Users struct {
	Context context.Context
	Client  *datastore.Client
}

Users implements user.Repo.

func (*Users) ByCredentials

func (repo *Users) ByCredentials(cred *auth.Credentials) (*user.User, error)

ByCredentials finds user info based on credentials.

func (*Users) ByID

func (repo *Users) ByID(id user.UserID) (*user.User, error)

ByID returns user by ID.

func (*Users) Create

func (repo *Users) Create(cred *auth.Credentials, u *user.User) (user.UserID, error)

Create creates a new user with the specified credentials and user info.

func (*Users) CreateCredentialAlias

func (repo *Users) CreateCredentialAlias(cred *auth.Credentials, existingUserID user.UserID) error

CreateCredentialAlias creates a new credential mapping pointing to an existing user.

func (*Users) FindCredentialByEmail

func (repo *Users) FindCredentialByEmail(email string) (user.UserID, error)

FindCredentialByEmail scans all credentials for a matching email and returns the associated UserID.

func (*Users) List

func (repo *Users) List() ([]*user.User, error)

List returns all users.

func (*Users) Update

func (repo *Users) Update(u *user.User) error

Update updates a user.

Jump to

Keyboard shortcuts

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