Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnswerRequest ¶
type Form ¶
type Form struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"`
Name string `gorm:"type:varchar(255);not null"`
Description string `gorm:"type:varchar(255);"`
Code string `gorm:"type:varchar(20);not null;unique"`
Questions []Question `gorm:"foreignKey:FormID"`
Responses []Response `gorm:"foreignKey:FormID"`
UserID uuid.UUID `gorm:"type:uuid;not null"`
Multiple bool `gorm:"type:boolean;not null"`
CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
}
type FormRequest ¶
type FormRequest struct {
Name string `validate:"required"`
Description string
Questions []QuestionRequest `validate:"required"`
Code string `validate:"required"`
Multiple bool
}
type OptionRequest ¶
type OptionRequest struct {
Text string
}
func (*OptionRequest) ToOption ¶
func (o *OptionRequest) ToOption() Option
type Question ¶
type Question struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"`
FormID uuid.UUID `gorm:"type:uuid;not null"`
Text string `gorm:"type:varchar(255);not null"`
Type string `gorm:"type:varchar(255);not null"`
Options []Option `gorm:"foreignKey:QuestionID"`
Required bool `gorm:"type:boolean;not null"`
}
type QuestionRequest ¶
type QuestionRequest struct {
Text string `validate:"required,max=255,min=1"`
Type string `validate:"required,max=255,min=1"`
Options []OptionRequest
Required bool `validate:"required"`
}
func (*QuestionRequest) ToQuestion ¶
func (q *QuestionRequest) ToQuestion() Question
type Response ¶
type Response struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"`
FormID uuid.UUID `gorm:"type:uuid;not null"`
UserID uuid.UUID `gorm:"type:uuid;not null"`
Answers []Answer `gorm:"foreignKey:ResponseID"`
CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
}
type ResponseRequest ¶
type ResponseRequest struct {
Answers []Answer `validate:"required"`
}
func (*ResponseRequest) ToResponse ¶
type User ¶
type User struct {
ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"`
Email string `gorm:"type:varchar(255);"`
Name string `gorm:"type:varchar(255);"`
Forms []Form `gorm:"foreignKey:UserID"`
PubKey string `gorm:"type:varchar(1024);not null;unique"`
CreatedAt time.Time `gorm:"autoCreateTime"`
UpdatedAt time.Time `gorm:"autoUpdateTime"`
}
type UserRequest ¶
func (*UserRequest) ToUser ¶
func (u *UserRequest) ToUser() User
Click to show internal directories.
Click to hide internal directories.