answer

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package answer provides Answer for a Question.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOption added in v0.0.3

func GetOption[T shared.N](a Answer) option.Option[T]

GetOption returns the option at the time of the answer.

Types

type Answer

type Answer struct {
	common.Common `json:",inline" bson:",inline"`

	// Question at the time of the answer.
	Question question.Question `json:"question" bson:"question"`

	// Option is the Option at the time of the answer.
	Option any `json:"option" bson:"option"`
}

Answer is an answer to a question.

func MustNew

func MustNew(
	q question.Question,
	option any,
) Answer

MustNew creates a new Answer and panics if there's an error.

func New

func New(
	q question.Question,
	option any,
) (Answer, error)

New creates a new Answer.

func (Answer) GetID

func (a Answer) GetID() string

GetID returns the ID of the option.

func (Answer) GetOption

func (a Answer) GetOption() any

GetOption returns the option at the time of the answer.

func (Answer) GetQuestion

func (a Answer) GetQuestion() question.Question

GetQuestion returns the question selected for the answer.

func (Answer) Validate

func (a Answer) Validate() error

Validate answer.

Jump to

Keyboard shortcuts

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