model

package
v0.0.0-...-984e724 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShuffleAnswers

func ShuffleAnswers(answers []*Answer)

Pseudorandom shuffle to prevent order bias in answers

Types

type Answer

type Answer struct {
	QuestionName string
	Name         string
	Position     int
	Checked      bool
	Sentence     string
	VoteCount    int
}

func FetchAnswers

func FetchAnswers(ctx context.Context, db db.Service, questionName string) ([]*Answer, error)

type Question

type Question struct {
	Name         string
	Position     int
	Title        string
	Sentence     string
	MinChoices   int
	MaxChoices   int
	VoteOpen     bool
	VoteCount    int
	VotedAlready bool      // computed field if requesterUuid is provided
	Answers      []*Answer // might not be populated
}

func FetchQuestion

func FetchQuestion(ctx context.Context, db db.Service, requesterUuid, questionName string) (*Question, error)

func FetchQuestions

func FetchQuestions(ctx context.Context, db db.Service, requesterUuid string) ([]*Question, error)

type User

type User struct {
	Uuid         string
	PublicToken  string
	PrivateToken string
	Fullname     string
	Email        string
	Admin        bool
	CreatedAt    time.Time
}

func FetchUser

func FetchUser(ctx context.Context, db db.Service, privateToken string) (*User, error)

Jump to

Keyboard shortcuts

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